/* ==========================================================================
   RESET & ZMIENNE (MODERN PALETTE)
   ========================================================================== */
:root {
    --primary: #3b82f6;       /* Nowoczesny niebieski */
    --primary-hover: #2563eb; /* Ciemniejszy niebieski po najechaniu */
    --bg-body: #f3f4f6;       /* Bardzo jasny szary dla tła strony */
    --bg-card: #ffffff;       /* Białe tło dla kart */
    --text-main: #1f2937;     /* Ciemny grafit zamiast czystej czerni */
    --text-muted: #6b7280;    /* Szary tekst dla opisów */
    --border: #e5e7eb;        /* Delikatne obramowania */
    --danger: #ef4444;        /* Czerwony dla usuwania/błędów */
    --success: #10b981;       /* Zielony dla sukcesów */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;           /* Zaokrąglenie rogów */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ==========================================================================
   NAGŁÓWEK (HEADER)
   ========================================================================== */
.main-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.main-header strong {
    font-size: 1.2rem;
    color: var(--primary);
}

.main-header nav {
    display: flex;
    gap: 20px;
}

.main-header nav a {
    font-weight: 500;
    color: var(--text-main);
    transition: color 0.2s;
}

.main-header nav a:hover {
    color: var(--primary);
}

/* ==========================================================================
   UKŁAD GŁÓWNY (CONTAINER)
   ========================================================================== */
.container, .main-content {
    max-width: 1200px;
    width: 95%;
    margin: 2rem auto;
    padding: 0;
}

/* ==========================================================================
   ELEMENTY FORMULARZY I PRZYCISKI
   ========================================================================== */
button, .btn {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-align: center;
    font-weight: 500;
}

button:hover, .btn:hover {
    background-color: var(--primary-hover);
}

button:active, .btn:active {
    transform: scale(0.98);
}

.btn.remove, button.red {
    background-color: var(--danger);
}
.btn.remove:hover, button.red:hover {
    background-color: #dc2626;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f9fafb;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* ==========================================================================
   KARTY I SEKCJE (LOGOWANIE, DODAWANIE, PORTFEL)
   ========================================================================== */
/* Środek ekranu dla logowania/rejestracji */
body > section { 
    max-width: 400px;
    margin: 4rem auto;
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

body > section h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* Kontener dodawania produktu */
.add-product-container, .wallet-box {
    max-width: 600px;
    margin: 3rem auto;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.msg {
    padding: 1rem;
    background: #dbeafe;
    color: #1e40af;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    text-align: center;
}
.error {
    background: #fee2e2;
    color: #991b1b;
}

/* ==========================================================================
   LISTA PRODUKTÓW (GRID)
   ========================================================================== */
.featured-products, .content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.product {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.product:hover {
    transform: translateY(-5px);
}

.product img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background-color: #f0f0f0;
}

/* Styl dla listy w browse.php (układ poziomy wewnątrz karty) */
.product .info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.product p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.product .price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: auto; /* Dopycha cenę do dołu */
    margin-bottom: 1rem;
}

/* ==========================================================================
   KOSZYK (CART)
   ========================================================================== */
.item {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    gap: 1.5rem;
}

.item img {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    object-fit: cover;
}

.item .info {
    flex-grow: 1;
}

.item .row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
}

.qty-input {
    width: 80px;
    margin: 0;
    padding: 0.5rem;
    text-align: center;
}

.total {
    text-align: right;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 2rem 0;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
}

/* ==========================================================================
   SZCZEGÓŁY PRODUKTU (PRODUCT.PHP)
   ========================================================================== */
.card {
    display: flex;
    gap: 2rem;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 3rem auto;
}

.card img {
    width: 50%;
    border-radius: var(--radius);
    object-fit: cover;
}

/* ==========================================================================
   SIDEBAR (BROWSE.PHP)
   ========================================================================== */
/* Specjalny layout dla browse.php */
.container:has(.sidebar) {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ==========================================================================
   TABELE (ORDER SUCCESS)
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: #f9fafb;
    font-weight: 600;
}

/* ==========================================================================
   RESPONSYWNOŚĆ (MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .main-header nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .container:has(.sidebar) {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }

    .card {
        flex-direction: column;
    }
    
    .card img {
        width: 100%;
    }

    .item {
        flex-direction: column;
        text-align: center;
    }
    
    .item .row {
        justify-content: center;
    }
}