/* ============================================================
   Custom Hand-drawn Shop — Motta Child
   Φορτώνεται ΜΟΝΟ στη σελίδα με το template-custom-shop.php
   ============================================================ */

:root {
    --primary: #52899b;
    --accent-yellow: #f8e16c;
    --sale-red: #e74c3c;
    --light-bg: #f5f9fa;
    --border-color: #333;
}

/* --- 1. Wrapper: Sidebar + Content --- */
.custom-shop-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    max-width: 1300px;
    margin: 40px auto;
    padding: 0 20px;
    /* Comfortaa: στρογγυλή/φιλική όψη ΜΕ πλήρη ελληνική υποστήριξη.
       Χωρίς "cursive" στο fallback — στο Android αποδίδεται ως καλλιγραφική. */
    font-family: 'Comfortaa', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* --- 2. Sidebar --- */
.custom-shop-sidebar {
    flex: 0 0 260px;
    padding: 25px;
    position: sticky;
    top: 100px;
    background: #fff;
    border: 3px solid var(--border-color);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 4px 5px 0 rgba(0,0,0,0.1);
}

.sidebar-title {
    color: var(--primary);
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 10px;
    margin: 22px 0 16px 0;
    font-size: 1.05em;
}
.sidebar-title:first-child { margin-top: 0; }

.custom-filter-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
}
.custom-filter-list li { margin-bottom: 12px; }

.custom-filter-list a {
    text-decoration: none;
    color: #2c3e50;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.custom-filter-list a::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 10px;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 4px 8px 3px 6px / 7px 3px 8px 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.custom-filter-list a:hover { color: var(--primary); }
.custom-filter-list a:hover::before {
    background: var(--accent-yellow);
    transform: scale(1.1) rotate(6deg);
}
.custom-filter-list a.active-filter { color: var(--primary); font-weight: bold; }
.custom-filter-list a.active-filter::before {
    background: var(--primary);
    border-color: var(--border-color);
    box-shadow: 2px 2px 0 var(--border-color);
}

.cat-count { margin-left: 6px; font-size: 0.8em; color: #718096; font-weight: normal; }

/* Αστεράκια στη λίστα βαθμολογίας */
.cs-rating-list .cs-stars { color: var(--accent-yellow); letter-spacing: 1px; text-shadow: 0 0 1px var(--border-color); }

/* --- 3. Price Range Slider (hand-drawn) --- */
/* Flex column: slider → τιμή → κουμπί, με καθαρά κενά. Καμία επικάλυψη. */
.cs-price-filter {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 16px 0 6px;
}

/* Container διάφανος, χωρίς border/background */
.custom-shop-sidebar .cs-price-slider {
    position: relative;
    height: 26px;
    margin: 0 10px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
}

/* Λεπτή ζωγραφιστή "μολυβιά" 4px — χωρίς λευκό border */
.custom-shop-sidebar .cs-slider-track {
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 4px;
    transform: translateY(-50%);
    background: var(--border-color);
    border: 0;
    border-radius: 4px 7px 4px 7px / 7px 4px 7px 4px;
}
/* Το γεμάτο (επιλεγμένο) εύρος */
.custom-shop-sidebar .cs-slider-fill {
    position: absolute;
    top: 0; bottom: 0;
    left: 0;
    background: var(--primary);
    border-radius: inherit;
}

/* Δύο range inputs στοιβαγμένα.
   Τα !important είναι απαραίτητα: το Motta στιλίζει τα inputs ως πεδία φόρμας
   (λευκό φόντο, border, ύψος ~50px) και ξεχείλιζε πάνω στο κίτρινο κουτί. */
.custom-shop-sidebar .cs-price-slider .cs-slider-input {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    display: block !important;
    width: 100% !important;
    height: 26px !important;
    min-height: 0 !important;
    max-height: 26px !important;
    line-height: 26px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    pointer-events: none;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}
.custom-shop-sidebar .cs-slider-input::-webkit-slider-runnable-track {
    height: 4px; background: transparent; border: 0;
}
.custom-shop-sidebar .cs-slider-input::-moz-range-track {
    height: 4px; background: transparent; border: 0;
}
.custom-shop-sidebar .cs-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    margin-top: -9px;            /* (4px track - 22px thumb) / 2 → κεντράρισμα */
    width: 22px; height: 22px;
    background: var(--accent-yellow);
    border: 3px solid var(--border-color);
    border-radius: 60% 40% 55% 45% / 50% 55% 45% 50%;
    cursor: grab;
}
.custom-shop-sidebar .cs-slider-input::-webkit-slider-thumb:active { cursor: grabbing; }
.custom-shop-sidebar .cs-slider-input::-moz-range-thumb {
    pointer-events: auto;
    width: 22px; height: 22px;
    background: var(--accent-yellow);
    border: 3px solid var(--border-color);
    border-radius: 60% 40% 55% 45% / 50% 55% 45% 50%;
    cursor: grab;
}

.cs-price-values {
    text-align: center;
    font-size: 0.95em;
    font-weight: 700;
    color: var(--border-color);
    background: var(--accent-yellow);
    border: 2px solid var(--border-color);
    border-radius: 10px 16px 10px 16px / 16px 10px 16px 10px;
    padding: 7px 10px;
    margin: 0;
}
.cs-price-values .cs-pv-min,
.cs-price-values .cs-pv-max {
    color: var(--primary);
    font-size: 1.05em;
}
.cs-price-apply { display: block; width: 100%; text-align: center; margin: 0; }

/* --- 4. Content --- */
.custom-shop-content { flex: 1; min-width: 0; }

.cs-shop-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--border-color);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.cs-results-count {
    font-size: 0.95em;
    color: #718096;
    margin-bottom: 18px;
    font-weight: bold;
}

/* --- 5. Products Grid --- */
.custom-shop-content .grid-products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 0;
}

/* --- 6. Product Card --- */
.custom-shop-content .product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 20px;
    background: #fff;
    border: 3px solid var(--border-color);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 4px 5px 0 rgba(0,0,0,0.1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}

/* Sale badge — λευκό φόντο, κόκκινο border + κόκκινα bold γράμματα */
.custom-shop-content .product-card .cs-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background: #fff;
    color: var(--sale-red);
    font-weight: 700;
    font-size: 0.78em;
    letter-spacing: 0.3px;
    line-height: 1.2;
    white-space: nowrap;
    padding: 4px 10px;
    border: 3px solid var(--sale-red);
    border-radius: 14px 4px 14px 4px / 4px 14px 4px 14px;
    box-shadow: 2px 2px 0 rgba(231, 76, 60, 0.35);
}

/* Image wrapper — σταθερό ύψος, μόνο η βασική εικόνα (χωρίς βελάκια/hover swap) */
.custom-shop-content .product-img-wrapper {
    display: block;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 180px;
    margin-bottom: 15px;
}
.custom-shop-content .product-img-wrapper .cs-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.product-title {
    font-size: 1.1em;
    margin: 0 0 8px 0;
    line-height: 1.3;
    min-height: 2.6em;
}
.product-title a { text-decoration: none; color: var(--border-color); }

/* Rating κάτω από τον τίτλο */
.cs-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.9em;
}

/* Καθαρά χρυσά αστεράκια — ανεξάρτητα από το WooCommerce font.
   Τεχνική επικάλυψης: γκρι base + χρυσό fill βάσει inline width % */
.cs-rating .star-rating {
    position: relative;
    display: inline-block;
    width: 5.6em;
    height: 1em;
    line-height: 1;
    font-size: 1.05em;
    font-family: 'Times New Roman', Georgia, serif; /* γεμάτο ★ glyph */
    vertical-align: middle;
    overflow: hidden;
}
.cs-rating .star-rating::before {
    content: "\2605\2605\2605\2605\2605";
    position: absolute;
    left: 0; top: 0;
    color: #dfe3e6;                 /* άδεια αστέρια */
    letter-spacing: 0.14em;
    white-space: nowrap;
}
.cs-rating .star-rating span {
    position: absolute;
    left: 0; top: 0;
    display: block;
    height: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-indent: -9999px;           /* κρύβει το "Rated x out of 5" */
}
.cs-rating .star-rating span::before {
    content: "\2605\2605\2605\2605\2605";
    position: absolute;
    left: 0; top: 0;
    text-indent: 0;
    color: #f5b301;                 /* χρυσό/κίτρινο */
    letter-spacing: 0.14em;
    text-shadow: 0 1px 0 rgba(0,0,0,0.18);
    white-space: nowrap;
}
.cs-rating-count { color: #718096; font-size: 0.85em; }

.product-price {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.25em;
    display: block;
    margin-bottom: 15px;
}
.product-price del { color: #a0aec0; font-weight: normal; font-size: 0.85em; margin-right: 4px; }
.product-price ins { text-decoration: none; }

/* Το κουμπί καλάθι πάντα τέρμα κάτω */
.cs-cart-btn { margin-top: auto; align-self: center; }

/* Ο σύνδεσμος "Προβολή καλαθιού" που προσθέτει το WooCommerce μετά το AJAX
   add-to-cart — τον κρύβουμε, η ενημέρωση γίνεται μέσω του toast. */
.custom-shop-content .product-card .added_to_cart,
.custom-shop-content .product-card .wc-forward {
    display: none !important;
}

/* Hand-drawn button */
.handdrawn-btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 12px 25px;
    text-decoration: none;
    font-weight: bold;
    border: 3px solid var(--border-color);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 3px 3px 0 var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.handdrawn-btn.small { padding: 8px 15px; font-size: 0.9em; }
.handdrawn-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--border-color);
    color: #fff;
}
.handdrawn-btn.loading, .handdrawn-btn.added { opacity: 0.75; }

/* Hover bouncy */
.hover-bouncy:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 20px rgba(82, 137, 155, 0.15);
}

/* --- 7. Infinite scroll UI --- */
.cs-infinite { text-align: center; margin-top: 40px; }
.cs-loader { color: var(--primary); font-weight: bold; margin-bottom: 14px; }
.cs-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 3px solid rgba(82,137,155,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 6px;
    animation: cs-spin 0.7s linear infinite;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }
.cs-sentinel { height: 1px; width: 100%; }

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 1.1em;
    color: #718096;
}

/* --- 8. Toast ειδοποίηση καλαθιού --- */
.cs-toast {
    position: fixed;
    /* Το toast προσαρτάται στο <body>, οπότε δεν κληρονομεί τη γραμματοσειρά */
    font-family: 'Comfortaa', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    top: 0;
    left: 50%;
    transform: translate(-50%, -120%);
    z-index: 99999;
    background: #fff;
    color: var(--border-color);
    border: 3px solid var(--border-color);
    border-radius: 12px 22px 12px 22px / 22px 12px 22px 12px;
    box-shadow: 4px 5px 0 rgba(0,0,0,0.15);
    padding: 14px 22px;
    font-size: 0.95em;
    max-width: 90vw;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.cs-toast-show { transform: translate(-50%, 20px); }
.cs-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    flex-shrink: 0;
}

/* --- 9. Κουμπί φίλτρων (μόνο κινητά) --- */
/* Ίδιο στυλ με το κουμπί "Καλάθι", αλλά τελείως στρογγυλεμένο */
.cs-filters-toggle {
    display: none;                /* ενεργοποιείται στο mobile breakpoint */
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 10px 22px !important;
    margin: 0 !important;
    font-family: inherit;
    font-size: 0.9em;
    font-weight: bold;
    letter-spacing: 0.5px;
    line-height: 1;
    color: #fff !important;
    background: var(--primary) !important;
    border: 3px solid var(--border-color) !important;
    border-radius: 999px !important;
    box-shadow: 3px 3px 0 var(--border-color) !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cs-filters-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}
/* "Πατημένη" όψη όσο ο πίνακας είναι ανοιχτός */
body.cs-filters-open .cs-filters-toggle {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--border-color) !important;
}

/* Μικρό "Χ" κλεισίματος μέσα στον πίνακα */
.cs-filters-close {
    display: none;                /* ενεργοποιείται στο mobile breakpoint */
    position: absolute;
    top: 10px;
    right: 16px;
    z-index: 2;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 1.6em;
    line-height: 1;
    color: #333 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer;
}
.cs-filters-close:hover { color: var(--primary) !important; }

/* Σε desktop δεν υπάρχουν καθόλου */
@media (min-width: 769px) {
    .cs-filters-toggle,
    .cs-filters-close { display: none !important; }
}

/* --- 10. Responsive --- */
@media (max-width: 1024px) {
    .custom-shop-content .grid-products { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (max-width: 768px) {
    .custom-shop-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .cs-filters-toggle { display: inline-flex; }

    /* Ο πίνακας φίλτρων: κλειστός εξ ορισμού, ανοίγει με το κουμπί.
       Μένει στη ροή — πάνω από τα προϊόντα, κάτω από το header. */
    .custom-shop-sidebar {
        display: none;
        position: relative;       /* σημείο αναφοράς για το "Χ" */
        flex: none;
        width: 100%;
        max-width: none;
        margin: 0;
        top: auto;
        padding-top: 46px;        /* χώρος ώστε το "Χ" να μην ακουμπάει τον τίτλο */
    }
    body.cs-filters-open .custom-shop-sidebar {
        display: block;
        animation: cs-filters-in 0.25s ease-out;
    }

    .cs-filters-close { display: flex; }

    .custom-shop-content { width: 100%; }
}

@keyframes cs-filters-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
    .custom-shop-content .grid-products { grid-template-columns: 1fr; }
    .product-img-wrapper { height: 200px; }
}
.cs-cat-description { margin: 0 0 14px; line-height: 1.6; color: #4a5568; max-width: 70ch; }
.cs-cat-description p { margin: 0 0 0.8em; }
.cs-cat-description > :last-child { margin-bottom: 0; }