/* --- ZMIENNE (Łatwa edycja kolorów) --- */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --success-color: #27ae60;
    --danger-color: #dc3545;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --border-radius: 12px; /* Bardziej zaokrąglone rogi = nowocześniej */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.12);
}

#google_translate_element {
    display: inline-block; /* lub block */
    min-width: 100px; /* Rezerwuje miejsce zanim widget się załaduje */
}

/* --- OGÓLNE --- */
html {
    box-sizing: border-box;
    font-size: 16px; /* Baza dla rem */
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    padding-bottom: 50px; /* Miejsce na stopkę lub oddech na dole */
}

/* Tło strony (tak jak w twoim oryginale) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url('uploads/probka.jpg');
    background-repeat: repeat;
    background-size: 250px;
    opacity: 0.3;
    pointer-events: none;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

h1, h2, h3 {
    margin: 0 0 15px 0;
    font-weight: 700;
    line-height: 1.2;
}

/* --- KONTENER --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* --- NAGŁÓWEK (HEADER) --- */
header {
    background: #2c3e50;
    color: var(--white);
    padding: 15px 0;
    width: 100%;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    /* To jest kluczowe: rozkłada elementy od lewej do prawej z równymi odstępami "pomiędzy" */
    justify-content: space-between; 
    align-items: center;
    flex-wrap: wrap; /* Pozwoli przenieść elementy niżej na małym ekranie */
    gap: 15px; /* Minimalny odstęp, żeby się nie stykały */
}

header h1 a {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    /* Usuwamy margin, żeby flexbox ładnie wyrównał */
    margin: 0; 
}

/* Grupowanie prawej strony nagłówka */
header .header-tools {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Waluty */
header .currency-switcher {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95rem;
    background: rgba(255,255,255,0.1);
    padding: 5px 10px;
    border-radius: 20px;
}

header .currency-switcher span {
    display: none; /* Ukrywamy tekst "Wybierz walutę" na mobile dla oszczędności miejsca */
}

@media (min-width: 768px) {
    header .currency-switcher span { display: inline; margin-right: 5px; opacity: 0.8; font-size: 0.85rem;}
}

header .currency-switcher a {
    color: rgba(255,255,255,0.7);
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.9rem;
}

header .currency-switcher a.active,
header .currency-switcher a:hover {
    background-color: var(--white);
    color: #2c3e50;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Koszyk w nagłówku */
header a[href="checkout.php"] {
    background: var(--success-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
    /* Ważne: żeby koszyk nie rozciągał się na całą wysokość */
    align-self: center; 
}

header a[href="checkout.php"]:active {
    transform: scale(0.95);
}

#cart-count {
    background: var(--white);
    color: var(--success-color);
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* --- KAFELKI PRODUKTÓW (GRID) --- */
.grid {
    display: grid;
    /* Automatyczne dopasowanie, ale nie węższe niż 280px */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 25px;
    padding-bottom: 40px;
}

.card {
    background: var(--white);
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-sm);
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-body h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 10px 0;
}

.stock {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

/* --- PRZYCISKI --- */
.btn {
    display: inline-block;
    width: 100%;
    padding: 14px 20px; /* Duże pole kliknięcia */
    border: none;
    cursor: pointer;
    text-align: center;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.3s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary { background: var(--primary-color); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success-color); color: var(--white); }
.btn-success:hover { background: #219150; }

.btn-danger { background: var(--danger-color); color: var(--white); }
.btn-danger:hover { background: #c82333; }

/* --- STRONA PRODUKTU (DETALE) --- */
.product-detail-container {
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.main-image-wrapper {
    position: relative;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    background: #fff;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    overflow: hidden;
}

#mainImage {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

/* Galeria miniatur - powiększona dla palców */
.thumbs-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 12px;
}

.gallery-thumbs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px;
    scroll-behavior: smooth;
    /* Ukrywanie scrollbara */
    scrollbar-width: none;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumbs img {
    width: 90px; /* Większe miniatury */
    height: 90px;
    object-fit: contain;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: var(--white);
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.gallery-thumbs img.active,
.gallery-thumbs img:hover {
    border-color: var(--primary-color);
}

.thumb-nav {
    width: 44px; /* Minimalny rozmiar dotyku */
    height: 44px;
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-dark);
    flex-shrink: 0;
}

/* Formularz dodawania do koszyka */
.add-to-cart-form {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.qty-input {
    padding: 12px;
    width: 80px;
    text-align: center;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 8px;
}

.btn-inline {
    width: auto;
    flex-grow: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* --- KOSZYK (TABELA) --- */
.cart-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px; /* Odstępy między wierszami */
}

.cart-table th {
    text-align: left;
    padding: 10px 15px;
    color: var(--text-light);
    font-weight: 600;
    white-space: nowrap; /* Zapobiega łamaniu nagłówków */
}

.cart-table td {
    background: var(--white);
    padding: 15px;
    vertical-align: middle;
}

/* 1. NAPRAWA WYRÓWNANIA ZDJĘCIA I NAZWY */
.cart-table td:first-child { 
    border-top-left-radius: 8px; 
    border-bottom-left-radius: 8px; 
    display: flex;
    align-items: center; /* Wyśrodkowanie w pionie zdjęcia i tekstu */
    gap: 15px; /* Równy odstęp między zdjęciem a nazwą */
    min-width: 280px; /* Gwarantuje, że nazwa będzie w jednej linii */
}

/* 2. NAPRAWA ŁAMANIA SIĘ CEN I ILOŚCI */
.cart-table td:nth-child(2),
.cart-table td:nth-child(3),
.cart-table td:nth-child(4) {
    white-space: nowrap; /* Wymusza trzymanie ceny (np. 120.00 PLN) w jednej linii */
}

.cart-table tr td:last-child { 
    border-top-right-radius: 8px; 
    border-bottom-right-radius: 8px; 
}

/* Zdjęcie w koszyku */
.cart-img { 
    width: 60px; 
    height: 60px; 
    object-fit: cover; 
    border-radius: 6px; 
    flex-shrink: 0; /* Zapobiega zgniataniu zdjęcia */
}

/* Responsive table for mobile */
@media (max-width: 600px) {
    .cart-table thead { display: none; }
    .cart-table, .cart-table tbody, .cart-table tr, .cart-table td {
        display: block;
        width: 100%;
    }
    .cart-table tr {
        margin-bottom: 15px;
        box-shadow: var(--shadow-sm);
        border-radius: 8px;
    }
    
    /* Na telefonach wyłączamy flex, żeby ładnie ułożyć elementy pod sobą */
    .cart-table td:first-child {
        display: block;
        text-align: center;
    }

    .cart-table td {
        text-align: center;
        padding: 15px;
        position: relative;
        border-bottom: 1px solid #eee;
        white-space: normal; /* Na telefonie pozwalamy na łamanie tekstu */
    }
}

/* --- LIGHTBOX --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
}

.lightbox.active { display: flex; }

.lightbox-content {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 4px;
}

.lb-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 2.5rem;
    padding: 10px; /* Większy obszar kliknięcia */
    cursor: pointer;
}

.lb-prev, .lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    /* padding: 20px; <-- USUŃ TO (flexbox centruje lepiej bez paddingu przy sztywnym width/height) */
    
    color: white; /* Kolor strzałki */
    font-size: 2rem;
    cursor: pointer;
    
    /* --- ZMIANA: Ciemne tło (0.6 to 60% krycia) dla lepszego kontrastu --- */
    background: rgba(0, 0, 0, 0.6);
    
    /* Opcjonalnie: Biała obwódka dla lepszej widoczności na ciemnych zdjęciach */
    border: 2px solid rgba(255,255,255,0.3);
    
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Cień sprawi, że przycisk "wyskoczy" nad zdjęcie */
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    
    /* Zapobiega podświetlaniu na niebiesko przy dotyku na telefonach */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    z-index: 2001; /* Upewniamy się, że są nad obrazkiem */
}
.lb-prev:active, .lb-next:active {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(0.95);
}
.lb-prev { left: 10px; }
.lb-next { right: 10px; }


/* --- RESPIONSYWNOŚĆ (MEDIA QUERIES) --- */
@media (max-width: 768px) {
    /* Nagłówek na telefonie */
    header .container {
        flex-direction: row; /* Zostawiamy w rzędzie */
        justify-content: space-between;
        padding: 0 15px;
    }

    /* Nazwa sklepu mniejsza */
    header h1 a { font-size: 1.2rem; }
    
    /* Koszyk bardziej kompaktowy */
    header a[href="checkout.php"] {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* Ukryj mniej ważne elementy jeśli trzeba, ale tu wszystko się mieści */
    
    .grid {
        grid-template-columns: 1fr; /* Jeden kafelek na rząd na małych ekranach */
        gap: 20px;
    }
    
    .card-img { height: 200px; }
    
    .gallery-thumbs img { width: 70px; height: 70px; }
    
    /* Powiększenie przycisków na dole ekranu */
    .btn {
        padding: 16px; /* Jeszcze większe dla kciuka */
    }
}

/* --- STYLIZACJA GOOGLE TRANSLATE (DODATEK) --- */

/* 1. Ukrywamy irytujący pasek Google na samej górze strony */
.goog-te-banner-frame.skiptranslate {
    display: none !important;
}
body {
    top: 0px !important; /* Wymuszenie braku odstępu od góry */
}

/* 2. Ukrywamy tekst "Powered by Google" w widgecie */
.goog-te-gadget {
    font-family: inherit !important; /* Dziedzicz czcionkę strony */
    font-size: 0 !important; /* To trik, który ukrywa tekst obok listy */
    color: transparent !important;
}

/* 3. Stylizujemy samą listę rozwijaną (select) */
.goog-te-gadget .goog-te-combo {
    margin: 0 !important;
    padding: 6px 12px !important;
    color: #333;
    background-color: #f8f9fa;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px; /* Zaokrąglenie pasujące do Twoich przycisków */
    font-size: 0.85rem !important;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    height: auto;
    vertical-align: middle;
}

/* Opcjonalnie: zmiana koloru po najechaniu */
.goog-te-gadget .goog-te-combo:hover {
    background-color: #fff;
    border-color: #fff;
}

/* --- BANER COOKIES --- */
#cookie-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(44, 62, 80, 0.95); /* Ciemny kolor z header.php z lekką przezroczystością */
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    z-index: 9999; /* Musi być na samym wierzchu */
    
    /* Animacja wysuwania */
    transform: translateY(100%);
    transition: transform 0.4s ease-out;
}

#cookie-notice.show {
    transform: translateY(0);
}

#cookie-notice p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 800px;
}

#cookie-notice .btn-cookie {
    background: var(--success-color);
    color: var(--white);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

#cookie-notice .btn-cookie:hover {
    background: #219150;
}

/* Responsywność na telefony */
@media (max-width: 768px) {
    #cookie-notice {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 20px;
    }
}

/* --- TOAST NOTIFICATIONS (POWIADOMIENIA) --- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Żeby kliknięcia przechodziły przez pusty obszar kontenera */
}

.toast {
    background: var(--success-color);
    color: var(--white);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    
    /* Animacja */
    opacity: 0;
    transform: translateX(100%); /* Zaczyna schowany za prawą krawędzią */
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Efekt lekkiego odbicia */
}

.toast.show {
    opacity: 1;
    transform: translateX(0); /* Wjeżdża na ekran */
}

.toast.error {
    background: var(--danger-color); /* Czerwony dla błędów (np. brak w magazynie) */
}

/* Na telefonach powiadomienie na dole na całej szerokości */
@media (max-width: 600px) {
    #toast-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    .toast {
        justify-content: center;
    }
}