/* ==========================================================================
   CART.CSS - Style strony Koszyka (Lista produktów, Personalizacja, Sumy)
   ========================================================================== */

/* =========================================
   1. GŁÓWNY UKŁAD KOSZYKA
   ========================================= */

.cart-flex-wrapper {
    max-width: 1300px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--textMain);
}

.cart-header h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.woocommerce-cart-form {
    display: grid;
    grid-template-columns: 1fr 350px; /* Lewa kolumna elastyczna, prawa stała 350px */
    gap: 30px;
    align-items: start;
}

/* Efekt ładowania AJAX */
.woocommerce-cart-form.processing {
    opacity: 0.6;
    pointer-events: none; 
    cursor: wait;
    transition: opacity 0.3s;
}


/* =========================================
   2. KARTA PRODUKTU (LEWA KOLUMNA)
   ========================================= */

.cart-item-card {
    background: var(--cardBg);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--borderColor);
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.cart-item-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.cart-item-main {
    padding: 20px;
    display: flex;
    gap: 18px;
}

/* Miniaturka */
.product-thumbnail {
    width: 110px;
    flex-shrink: 0;
}

.product-thumbnail img {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
    aspect-ratio: 1/1;
    border: 1px solid #eee;
}

/* Informacje o produkcie */
.product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.product-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.product-title a {
    text-decoration: none;
    color: var(--textMain);
    transition: color 0.2s;
}

.product-title a:hover {
    color: var(--leadThemeDark);
}

/* Przycisk usuwania z koszyka (X) - okrągła ikona, spójna z resztą motywu */
.remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3f3f3;
    color: #999 !important;
    font-size: 1.3rem;
    line-height: 1;
    text-decoration: none;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.remove:hover {
    background: #ffe3e6;
    color: #ff4757 !important;
}

/* Wiersz z ilością i sumą */
.product-meta-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: auto;
}

.value {
    font-weight: 600;
}

/* Suma jako "chip" - zamiast etykiety "Suma:" */
.subtotal-block {
    margin-left: auto;
}

.value.highlight {
    display: inline-block;
    background: rgba(78, 210, 250, 0.12);
    color: var(--leadThemeDark);
    font-weight: 800;
    font-size: 0.95rem;
    padding: 7px 14px;
    border-radius: 20px;
}


/* =========================================
   3. KONTROLKI ILOŚCI (+ / -)
   ========================================= */

/* Ukrycie domyślnych strzałek przeglądarki */
input[type=number].qty::-webkit-inner-spin-button,
input[type=number].qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number].qty {
    -moz-appearance: textfield; 
}

/* Kontener ilości */
.quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    height: 40px; 
}

/* Przyciski +/- */
.qty-btn {
    background: #f9f9f9;
    border: none;
    width: 35px;
    height: 100%;
    font-size: 1.2rem;
    cursor: pointer;
    color: #555;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #eee;
    color: var(--leadThemeDark);
}

.qty-btn:active {
    background: #e0e0e0;
}

/* Pole input wpisywania ilości */
.quantity input.qty {
    width: 45px !important;
    height: 100% !important;
    border: none !important; 
    border-left: 1px solid #ddd !important;
    border-right: 1px solid #ddd !important;
    border-radius: 0 !important;
    text-align: center;
    font-weight: 600;
    padding: 0 !important;
    box-sizing: border-box;
    color: var(--textMain);
}

.quantity input.qty:focus {
    outline: none;
    box-shadow: none;
}

/* Stepper ilości w koszyku: jednolita "pigułka" bez przegródek między -/wartość/+ */
.cart-item-card .quantity {
    height: 38px;
    gap: 2px;
}

.cart-item-card .qty-btn {
    background: none;
    width: 26px;
}

.cart-item-card .qty-btn:hover {
    background: rgba(78, 210, 250, 0.12);
}

.cart-item-card .quantity input.qty {
    width: 28px !important;
    border-left: none !important;
    border-right: none !important;
}


/* =========================================
   4. STREFA PERSONALIZACJI (Upload i Uwagi)
   ========================================= */

.product-customization-area {
    background: #fafdff;
    border-top: 1px solid var(--borderColor);
    padding: 20px;
}

.customization-header {
    font-size: 0.85rem;
    color: var(--leadThemeDark);
    margin-bottom: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.customization-header svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.customization-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.cust-label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--textMain);
}

/* --- Sekcja Uploadu: "dropzone" --- */
.upload-dropzone {
    border: 1.5px dashed var(--leadTheme);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
    text-align: center;
    margin-bottom: 15px;
}

.upload-dropzone svg {
    width: 24px;
    height: 24px;
    color: var(--leadTheme);
    margin-bottom: 6px;
}

.upload-dropzone p {
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: var(--textLight);
}

.upload-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.button-outline {
    background: transparent !important;
    border: 1px solid var(--leadTheme) !important;
    color: var(--leadTheme) !important;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    text-align: center;
    display: inline-block;
    line-height: 1.2;
}

.button-outline:hover {
    background: var(--leadTheme) !important;
    color: #fff !important;
}

.upload-photo-btn {
    background: var(--leadTheme) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.upload-photo-btn:hover {
    background: var(--leadThemeDark) !important;
    transform: translateY(-1px);
}

/* Galeria wgranych zdjęć */
.uploaded-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.uploaded-img-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    text-align: center;
    font-weight: 700;
}

.uploaded-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
}

/* Eleganckie tło zastępcze, gdy wgrane zdjęcie nie może się załadować (plik
   wygasł lub został usunięty z serwera). Pseudo-elementy renderują się TYLKO
   dla "uszkodzonego" <img> - poprawnie wczytany obraz przykrywa je swoją
   treścią, więc na działających miniaturach są niewidoczne. */
.uploaded-img::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1.5px dashed #f0b4b4;
    border-radius: 6px;
    background: #fff6f6 url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23d9534f'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M10.29%203.86%201.82%2018a2%202%200%200%200%201.71%203h16.94a2%202%200%200%200%201.71-3L13.71%203.86a2%202%200%200%200-3.42%200z'/%3E%3Cline%20x1='12'%20y1='9'%20x2='12'%20y2='13'/%3E%3Cline%20x1='12'%20y1='17'%20x2='12.01'%20y2='17'/%3E%3C/svg%3E") no-repeat center 28%;
    background-size: 26px;
}

.uploaded-img::after {
    content: attr(alt);
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 7px 6px 9px;
    font-size: 0.6rem;
    line-height: 1.2;
    font-weight: 600;
    color: #c0392b;
    text-align: center;
}

.remove-uploaded-img {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.remove-uploaded-img:hover {
    transform: scale(1.2);
}

/* Wygląd zdjęć i błędów (wgrane przez klienta) */
.fotolabo-cart-upload-img {
    max-width: 60px;
    height: auto;
    border-radius: 4px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fotolabo-missing-file-alert {
    display: inline-block;
    background-color: #fff3cd; 
    color: #856404; 
    padding: 6px 12px;
    margin-top: 4px;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* --- Sekcja Notatek --- */
.cust-col-notes textarea {
    width: calc(100% - 20px);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
}

.cust-col-notes textarea:focus {
    outline: none;
    border-color: var(--leadTheme);
    box-shadow: 0 0 0 3px rgba(78, 210, 250, 0.1);
}


/* =========================================
   5. PRAWY PANEL (PODSUMOWANIE ZAMÓWIENIA)
   ========================================= */

.cart-right-panel {
    margin-top: 62px;
}

/* NAPRAWA: Włączenie przyklejania na desktopie! */
.cart-sidebar-sticky {
    position: sticky;
    top: 40px; 
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--borderColor);
}

.cart-collaterals h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.cart_totals {
    width: 100% !important;
}

.cart_totals table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.cart_totals th, .cart_totals td {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.cart_totals td {
    text-align: right;
    font-weight: 600;
}

/* --- Nowoczesny Paragon --- */
.cart-right-panel .cart_totals .cart-subtotal {
    display: none !important;
}

/* Wiersz "Łącznie" - większy, ciemny, pogrubiony akcent zamiast niebieskiego.
   Flex (space-between) zamiast układu tabelarycznego, bo na wąskim ekranie tabela
   potrafiła zwęzić komórkę etykiety do zera i "Łącznie" sklejało się z kwotą.
   Prefiks .cart-right-panel podnosi specyficzność, by pobić regułę WooCommerce
   '.shop_table_responsive tr { display: block }' aktywną poniżej 768px. */
.cart-right-panel .cart_totals .order-total {
    border-bottom: none;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

/* WooCommerce na mobile (<768px) ukrywa <th> i wstrzykuje etykietę kolumny jako
   td::before, przez co "Łącznie" i kwota lądowały w jednej komórce bez odstępu.
   Przywracamy widoczność <th> (lewa strona) i chowamy zduplikowaną etykietę. */
.cart-right-panel .cart_totals .order-total th {
    display: block;
}

.cart-right-panel .cart_totals .order-total td::before,
.cart-right-panel .cart_totals .fotolabo-receipt-row td::before {
    display: none;
}

.cart_totals .order-total th,
.cart_totals .order-total td {
    border-bottom: none;
    padding-top: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--textMain);
}

.cart_totals .order-total td strong {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--textMain);
}

.fotolabo-receipt-items {
    padding: 10px 0;
    margin-bottom: 15px;
}

.fotolabo-receipt-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.fotolabo-receipt-item:last-child {
    margin-bottom: 5px;
}

.receipt-name {
    color: #555;
    padding-right: 15px; 
}

.receipt-qty {
    color: #999;
    font-weight: 500;
    margin-left: 5px;
    font-size: 0.9rem;
}

.receipt-price {
    font-weight: 600;
    color: var(--textMain);
    white-space: nowrap; 
}

.plus-shipping-info {
    display: inline-block;
    font-size: 0.8rem;
    color: #999;
    font-weight: 400;
    margin: 4px 0;
    line-height: 1;
}

/* Przycisk Przejdź do kasy */
.wc-proceed-to-checkout {
    margin-top: 20px;
}

.checkout-button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 30px);
    text-align: center;
    background: linear-gradient(135deg, var(--leadTheme) 0%, var(--leadThemeDark) 100%) !important;
    color: #fff !important;
    padding: 16px !important;
    font-size: 1.05rem !important;
    border-radius: 9px !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none !important;
    box-shadow: 0 10px 22px rgba(78, 210, 250, 0.4);
}

.checkout-button::before {
    content: "";
    width: 18px;
    height: 18px;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%229%22%20cy%3D%2221%22%20r%3D%221%22%2F%3E%3Ccircle%20cx%3D%2220%22%20cy%3D%2221%22%20r%3D%221%22%2F%3E%3Cpath%20d%3D%22M1%201h4l2.68%2013.39a2%202%200%200%200%202%201.61h9.72a2%202%200%200%200%202-1.61L23%206H6%22%2F%3E%3C%2Fsvg%3E");
}

.checkout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(78, 210, 250, 0.5);
}


/* =========================================
   6. WIDOK PUSTEGO KOSZYKA
   ========================================= */

.fotolabo-empty-cart-wrapper {
    text-align: center;
    padding: 80px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    max-width: 600px;
    margin: 40px auto;
    border: 1px solid #f0f0f0;
}

.fotolabo-empty-cart-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.7;
    filter: grayscale(100%);
}

.fotolabo-empty-cart-wrapper h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.fotolabo-empty-cart-wrapper p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
    line-height: 1.5;
}

.fotolabo-empty-cart-wrapper .button {
    display: inline-block;
    background: #222;
    color: #fff;
    padding: 14px 35px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
}

.fotolabo-empty-cart-wrapper .button:hover {
    background: #444;
    transform: translateY(-2px);
}

.cart-bestsellers-wrapper .products::before {
    display: none !important;
}

.cart-bestsellers-wrapper .kafelek-add-cart a::after {
    display: none !important;
}


/* =========================================
   7. RESPONSYWNOŚĆ (MOBILE & TABLET)
   ========================================= */

@media (max-width: 900px) {
    .woocommerce-cart-form {
        grid-template-columns: 1fr; /* Jedna kolumna */
    }

    .cart-sidebar-sticky {
        position: static; /* Wyłączamy przyklejanie na mniejszych ekranach */
    }
    
    .customization-body {
        grid-template-columns: 1fr; /* Upload i Notatki jeden pod drugim */
    }
    
    .product-meta-row {
        justify-content: space-between;
        width: 100%;
    }
}

@media (max-width: 600px) {
    /* Zachowujemy układ poziomy (miniatura z lewej, treść z prawej) - spójny
       z wersją desktop. Tylko mniejsza miniatura i mniejszy padding, żeby
       zmieścić się na wąskim ekranie. Przycisk usuwania (×) zostaje w rogu. */
    .cart-item-main {
        padding: 16px;
        gap: 14px;
    }

    .product-thumbnail {
        width: 85px;
    }

    /* Wiersz ceny/ilości może się zawinąć na bardzo wąskich ekranach */
    .product-meta-row {
        flex-wrap: wrap;
        gap: 12px;
    }
}