/* ===================================================
   Erelia — Flower Dye Store Stylesheet
   Minimalist, elder-friendly design
   =================================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #FAF8F5;
    --bg-card: #FFFFFF;
    --bg-sidebar: #F5F2EE;
    --text: #2D2D2D;
    --text-muted: #6B6B6B;
    --accent: #7A9E7E;
    --accent-hover: #5F8563;
    --accent-light: #E8F0E9;
    --border: #E0DDD8;
    --danger: #C0392B;
    --danger-light: #FADBD8;
    --success: #27AE60;
    --success-light: #D5F5E3;
    --warning: #F39C12;
    --warning-light: #FCF3CF;
    --whatsapp: #25D366;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 64px;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    display: block;
}

/* --- Header --- */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.logo:hover {
    color: var(--accent);
}

.header-phone {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 1.2rem;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--whatsapp);
    color: #fff !important;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-whatsapp:hover {
    transform: scale(1.03);
    box-shadow: 0 3px 10px rgba(37, 211, 102, 0.3);
    color: #fff;
}

.btn-header {
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    transition: background 0.2s;
}

.btn-header:hover {
    background: var(--accent-light);
    color: var(--text);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: var(--text);
    padding: 0.3rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.cart-link:hover {
    background: var(--accent-light);
    color: var(--text);
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
    width: 100%;
}

/* --- Flash Messages --- */
.flash-message {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    animation: flashIn 0.3s ease;
}

.flash-success {
    background: var(--success-light);
    color: #1E8449;
    border: 1px solid #A9DFBF;
}

.flash-error {
    background: var(--danger-light);
    color: #922B21;
    border: 1px solid #F1948A;
}

@keyframes flashIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================================
   CATALOG — Two-Column Layout
   =================================================== */
.catalog-layout {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 2rem;
    align-items: start;
}

/* --- Sort Buttons --- */
.sort-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sort-btn {
    padding: 0.5rem 1.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.01em;
    user-select: none;
}

.sort-btn:hover {
    color: var(--accent-hover);
    border-color: var(--accent);
    background: var(--accent-light);
}

.sort-btn.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(122, 158, 126, 0.3);
}

.sort-btn.active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* --- Product Feed --- */
.product-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-card {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.25s, border-color 0.25s;
    height: 160px;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #ccc;
}

/* Gallery */
.product-gallery {
    display: flex;
    flex-direction: row;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    align-self: stretch;
}

.product-main-image {
    width: 160px;
    min-width: 160px;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.product-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-main-image img:hover {
    transform: scale(1.05);
}

/* Gallery arrows */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.75);
    border: none;
    font-size: 1.3rem;
    color: var(--text);
    cursor: pointer;
    width: 32px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 3;
}

.product-main-image:hover .gallery-arrow {
    opacity: 1;
}

.gallery-arrow:hover {
    background: rgba(255, 255, 255, 0.95);
}

.gallery-prev {
    left: 4px;
}

.gallery-next {
    right: 4px;
}

.placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.product-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 3px;
    overflow-y: auto;
    max-height: 100%;
    flex-shrink: 0;
}

.thumbnail {
    width: 35px;
    height: 35px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.thumbnail:hover {
    border-color: var(--accent);
    transform: scale(1.08);
}

/* Info row: details + actions wrapper */
.product-info-row {
    display: flex;
    flex: 1;
    min-width: 0;
}

/* Details (center) */
.product-details {
    flex: 1;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
}

.product-color-indicator {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 0.3rem;
    flex-shrink: 0;
}

.product-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.product-volume {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-hover);
    margin-top: 0.2rem;
}

/* Actions — right side */
.product-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.7rem;
    min-width: 200px;
    flex-shrink: 0;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
}

.qty-btn {
    padding: 0.3rem 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
    font-family: var(--font);
    border-right: 1px solid var(--border);
}

.qty-btn:last-child {
    border-right: none;
}

.qty-btn:hover {
    background: var(--accent-light);
}

.qty-btn:active {
    background: var(--accent);
    color: #fff;
}

.qty-big-btn {
    font-size: 0.78rem;
    color: var(--text);
    padding: 0.3rem 0.35rem;
}

.qty-value {
    padding: 0.2rem 0.5rem;
    font-size: 2rem;
    font-weight: 800;
    min-width: 2.8rem;
    text-align: center;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--accent-hover);
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.qty-value:active {
    background: var(--accent-light);
}

.btn-buy {
    width: 100%;
    padding: 0.45rem 0.8rem;
    font-size: 0.88rem;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    font-family: var(--font);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-buy svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-buy:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-buy:active {
    transform: translateY(0);
}

.btn-buy.added {
    background: var(--success);
    animation: buyPulse 0.4s ease;
}

@keyframes buyPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* "Go to Cart" button (appears after first add) */
.btn-go-cart {
    display: block;
    width: 100%;
    padding: 0.3rem 0.6rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--accent) !important;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s, opacity 0.3s;
    opacity: 0;
    transform: translateY(4px);
}

.btn-go-cart.visible {
    opacity: 1;
    transform: translateY(0);
}

.btn-go-cart:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

/* ===================================================
   COLOR PALETTE SIDEBAR
   =================================================== */
.color-palette {
    position: sticky;
    top: 80px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.palette-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    transition: color 0.3s;
}

.palette-group {
    margin-bottom: 0.8rem;
}

.palette-group-name {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.palette-shades {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.shade-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
}

.shade-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.shade-dot.active {
    transform: scale(1.4);
    border-color: var(--text);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* NEW group special dot */
.shade-dot-new {
    background: #FFFFFF !important;
    border: 1px solid #555555 !important;
    color: #B8860B;
    font-size: 7px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.02em;
    line-height: 1;
}

.shade-dot-new.active {
    border-color: #B8860B !important;
    box-shadow: 0 3px 12px rgba(184, 134, 11, 0.35);
}

/* NEW group mobile strip dot */
.mobile-color-dot-new {
    background: #FFFFFF !important;
    border: 1.5px solid #555555 !important;
    color: #B8860B;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    letter-spacing: -0.5px;
    padding: 0;
    overflow: hidden;
}

/* ===================================================
   HOVER PREVIEW (auto-dismiss)
   =================================================== */
.hover-preview {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
    animation: fadeIn 0.15s ease;
    transition: opacity 0.2s;
}

.hover-preview.visible {
    display: flex;
}

.hover-preview img {
    max-width: 85vw;
    max-height: 85vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.hover-preview video {
    max-width: 85vw;
    max-height: 85vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    background: #000;
}

/* ===================================================
   PERSISTENT IMAGE MODAL (click)
   =================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transition: opacity 0.15s;
}

.modal-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s;
    color: var(--text);
    z-index: 10;
}

.modal-close:hover {
    transform: scale(1.1);
}

/* Modal gallery arrows */
.modal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    border: none;
    font-size: 1.6rem;
    color: var(--text);
    cursor: pointer;
    width: 44px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
}

.modal-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
}

.modal-arrow-left {
    left: -60px;
}

.modal-arrow-right {
    right: -60px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===================================================
   CART PAGE
   =================================================== */
.cart-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
}

.btn-back-to-catalog {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.btn-back-to-catalog:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.cart-empty .btn-primary {
    margin-top: 1rem;
    display: inline-block;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
}

.cart-item-image img,
.placeholder-image-sm {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.placeholder-image-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.7rem;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.cart-item-volume {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.cart-item-price-single {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.cart-item-qty .qty-btn {
    padding: 0.35rem 0.7rem;
    font-size: 1rem;
}

.cart-qty-value {
    padding: 0.35rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 2.2rem;
    text-align: center;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    user-select: none;
}

.cart-item-subtotal {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-hover);
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.cart-item-remove:hover {
    color: var(--danger);
    background: var(--danger-light);
}

.cart-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    font-size: 1.15rem;
}

.cart-total strong {
    font-size: 1.4rem;
    color: var(--accent-hover);
}

.checkout-form-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.checkout-form-wrapper h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.checkout-user-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Messenger toggles */
.messenger-group {
    margin-bottom: 1rem;
}

.messenger-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.messenger-options {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.messenger-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.4;
    user-select: none;
}

.messenger-option:hover {
    opacity: 0.7;
}

.messenger-option input[type="checkbox"] {
    display: none;
}

.messenger-option input[type="checkbox"]:checked~.messenger-icon,
.messenger-option input[type="checkbox"]:checked~.messenger-name {
    opacity: 1;
}

.messenger-option:has(input:checked) {
    opacity: 1;
    border-color: var(--accent);
    background: var(--accent-light);
}

.messenger-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
}

.messenger-icon svg {
    width: 100%;
    height: 100%;
}

.messenger-wa svg {
    color: #25D366;
}

.messenger-tg svg {
    color: #2AABEE;
}

.messenger-vb svg {
    color: #7360F2;
}

.messenger-max svg {
    color: #0077FF;
}

.messenger-phone svg {
    color: #4CAF50;
}

.messenger-name {
    font-size: 0.82rem;
    font-weight: 600;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-style: italic;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    font-family: var(--font);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group input[type="color"] {
    height: 42px;
    padding: 2px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-primary {
    display: inline-block;
    padding: 0.65rem 1.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    font-family: var(--font);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font);
}

.btn-secondary:hover {
    background: var(--accent-light);
    color: var(--text);
}

.btn-checkout {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.05rem;
}

/* ===================================================
   AUTH PAGE
   =================================================== */
.auth-page {
    display: flex;
    justify-content: center;
    padding-top: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 480px;
}

.auth-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
}

.auth-block h1,
.auth-block h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.auth-divider {
    text-align: center;
    padding: 1rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-form .btn-primary {
    width: 100%;
}

/* ===================================================
   ADMIN
   =================================================== */
.admin-page {
    max-width: 1100px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.admin-header h1 {
    font-size: 1.5rem;
}

.admin-header div {
    display: flex;
    gap: 0.5rem;
}

/* Orders */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    border-left: 4px solid var(--border);
}

.order-status-new {
    border-left-color: var(--warning);
}

.order-status-processing {
    border-left-color: #3498DB;
}

.order-status-completed {
    border-left-color: var(--success);
}

.order-status-cancelled {
    border-left-color: var(--danger);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.order-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.status-form select {
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font);
}

.order-customer {
    display: flex;
    gap: 1.5rem;
    font-size: 0.88rem;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
}

.order-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.order-items-table th {
    background: var(--bg);
    padding: 0.4rem 0.6rem;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.order-items-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.item-color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    vertical-align: middle;
    margin-right: 0.3rem;
}

.order-total {
    text-align: right;
    font-size: 1rem;
}

/* Products Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-table th {
    background: var(--bg-sidebar);
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 0.5rem 0.8rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 4px;
}

.admin-thumb-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 4px;
}

.actions-cell {
    white-space: nowrap;
}

.btn-sm {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 4px;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    transition: background 0.2s;
}

.btn-sm:hover {
    background: var(--accent-light);
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* Product Form */
.product-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
}

.current-image {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.form-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.gallery-preview {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.gallery-item {
    position: relative;
    width: 60px;
    height: 60px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.btn-remove-image {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Upload progress overlay */
.upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.upload-overlay-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    text-align: center;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.upload-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.upload-status {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 1rem;
    font-weight: 500;
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.2s ease;
}

.upload-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

/* --- Volume Selector (Cart) --- */
.volume-selector {
    margin: 1.5rem 0;
    padding: 1.2rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.volume-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.volume-buttons {
    display: flex;
    gap: 0.5rem;
}

.volume-btn {
    flex: 1;
    max-width: 160px;
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.volume-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent-hover);
}

.volume-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(76, 145, 83, 0.3);
    transform: scale(1.02);
}

.volume-error {
    display: none;
    font-size: 0.85rem;
    color: var(--danger);
    margin-top: 0.5rem;
    font-weight: 500;
}

.volume-error.visible {
    display: block;
}

/* --- Empty Messages --- */
.empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 1rem;
}

/* --- Footer --- */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ===================================================
   MOBILE-ONLY COMPONENTS
   =================================================== */
.mobile-color-strip {
    display: none;
}

/* Hide per-card buy button — use bottom order bar instead */
.btn-buy,
.btn-go-cart {
    display: none !important;
}

/* ===================================================
   BOTTOM ORDER BAR (all screens)
   =================================================== */
.mobile-order-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 10px 24px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

.mobile-order-btn {
    display: block;
    padding: 10px 32px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    background: var(--accent);
    color: #fff !important;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: background 0.2s, transform 0.15s;
}

.mobile-order-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.mobile-order-btn:active {
    transform: translateY(0);
}

.mobile-total-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

/* Numpad overlay */
.numpad-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.numpad-overlay.active {
    display: flex;
}

.numpad-dialog {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.2rem;
    width: 260px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.numpad-display {
    font-size: 2.8rem;
    font-weight: 800;
    text-align: center;
    padding: 0.5rem;
    margin-bottom: 0.8rem;
    border-bottom: 2px solid var(--border);
    color: var(--accent-hover);
    min-height: 3.5rem;
    line-height: 1;
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.numpad-key {
    padding: 0;
    height: 56px;
    font-size: 1.4rem;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
    font-family: var(--font);
}

.numpad-key:active {
    background: var(--accent-light);
}

.numpad-backspace {
    background: #ffe0e0;
    color: #c33;
    border-color: #f5bab0;
}

.numpad-confirm {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-size: 1.6rem;
}

.numpad-confirm:active {
    background: var(--accent-hover);
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 900px) {
    html {
        font-size: 16px;
    }

    body {
        padding-bottom: 76px;
    }

    .main-content {
        padding: 0.4rem 0;
    }

    .site-header {
        display: none;
    }

    /* --- Hide desktop palette, show mobile components --- */
    .color-palette {
        display: none !important;
    }

    .mobile-color-strip {
        display: flex;
        flex-direction: column;
        gap: 5px;
        position: fixed;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 50;
        padding: 5px 3px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(8px);
        border-radius: 20px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    }

    .mobile-color-dot {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 2.5px solid rgba(0, 0, 0, 0.1);
        cursor: pointer;
        transition: transform 0.15s, box-shadow 0.15s;
        flex-shrink: 0;
    }

    .mobile-color-dot:active {
        transform: scale(1.25);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }

    .mobile-order-bar {
        flex-direction: column;
        gap: 4px;
        padding: 8px 16px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .mobile-order-btn {
        width: 100%;
        padding: 12px;
        font-size: 1.05rem;
    }

    .mobile-total-label {
        font-size: 1.3rem;
    }

    /* --- Sort buttons: full width on mobile --- */
    .sort-buttons {
        display: flex;
        gap: 0;
        margin-bottom: 0.4rem;
        border-radius: var(--radius);
        overflow: hidden;
        border: 1.5px solid var(--border);
        background: var(--bg-card);
    }

    .sort-btn {
        flex: 1;
        border: none;
        border-radius: 0;
        padding: 0.75rem 0.5rem;
        font-size: 1rem;
        font-weight: 700;
        text-align: center;
        letter-spacing: 0.02em;
    }

    .sort-btn:first-child {
        border-right: 1.5px solid var(--border);
    }

    .sort-btn:hover {
        border-color: transparent;
    }

    .sort-btn.active {
        box-shadow: none;
    }

    /* --- Catalog layout --- */
    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .product-feed {
        gap: 0.6rem;
        padding: 0 0.4rem;
        padding-right: 64px;
        /* room for bigger color strip */
    }

    /* --- Product card: VERTICAL --- */
    .product-card {
        flex-direction: column;
        height: auto;
        border-radius: var(--radius);
        border: 4px solid #666;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    }

    /* --- Gallery row: photo + thumbnails --- */
    .product-gallery {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        width: 100%;
        min-height: 0;
    }

    .product-main-image {
        flex: 1;
        width: 100%;
        min-width: 0;
        max-width: none;
        height: auto;
        aspect-ratio: 1;
    }

    .product-main-image .main-photo {
        pointer-events: none;
    }

    .product-main-image .gallery-arrow {
        pointer-events: auto;
    }

    /* Always show arrows on touch devices */
    .gallery-arrow {
        opacity: 0.7;
        width: 36px;
        height: 48px;
        font-size: 1.5rem;
    }

    .product-thumbnails {
        display: none;
    }

    /* --- Info row: vertical (details on top, qty below) --- */
    .product-info-row {
        flex-direction: column;
        width: 100%;
    }

    .product-details {
        padding: 0.4rem 0.6rem;
        gap: 0.1rem;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        border-bottom: 1px solid var(--border);
    }

    .product-color-indicator {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
        margin-bottom: 0;
        margin-right: 0.3rem;
    }

    .product-name {
        font-size: 0.88rem;
    }

    .product-volume {
        font-size: 0.7rem;
    }

    .product-price {
        font-size: 0.95rem;
    }

    /* --- Actions: qty in ONE row --- */
    .product-actions {
        border-left: none;
        border-top: none;
        min-width: auto;
        width: 100%;
        flex-direction: row;
        padding: 0.5rem 0.4rem;
        justify-content: center;
        align-items: center;
        gap: 0;
    }

    .qty-controls {
        flex-wrap: nowrap;
        justify-content: center;
        max-width: none;
        width: 100%;
    }

    .qty-btn {
        padding: 0.55rem 0.2rem;
        font-size: 0.9rem;
        flex: 1;
        min-width: 0;
    }

    .qty-big-btn {
        font-size: 0.9rem;
        padding: 0.55rem 0.2rem;
    }

    .qty-value {
        font-size: 2.7rem;
        padding: 0.15rem 0.5rem;
        min-width: 3rem;
    }

    .btn-buy {
        display: none;
    }

    .btn-go-cart {
        display: none;
    }

    /* --- Header: compact --- */
    .header-phone {
        display: none;
    }

    .btn-whatsapp span {
        display: none;
    }

    .header-inner {
        padding: 0.4rem 0.6rem;
    }

    /* --- Other pages --- */
    .cart-bottom {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .product-thumbnails {
        width: 60px;
    }

    .qty-big-btn {
        font-size: 0.9rem;
        padding: 0.55rem 0.2rem;
    }

    .cart-item {
        flex-wrap: wrap;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}

/* ===================================================
   SCROLLBAR (subtle)
   =================================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* ===================================================
   VIDEO GALLERY — Thumbnail Play Icon
   =================================================== */
.video-thumbnail-wrapper {
    position: relative;
    width: 35px;
    height: 35px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: border-color 0.2s, transform 0.2s;
}

.video-thumbnail-wrapper:hover {
    border-color: var(--accent);
    transform: scale(1.08);
}

.video-thumbnail-wrapper .thumbnail {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
}

.video-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    transition: background 0.2s;
}

.video-thumbnail-wrapper:hover .video-play-icon {
    background: rgba(0, 0, 0, 0.5);
}

.video-play-icon svg {
    width: 14px;
    height: 14px;
}

/* Gallery main image — Play overlay (when navigating to a video slide) */
.gallery-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s;
}

.gallery-play-overlay:hover {
    background: rgba(0, 0, 0, 0.45);
}

.gallery-play-overlay svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

/* Modal video */
.modal-video {
    outline: none;
}

/* Inline gallery video (plays in product card) */
.inline-gallery-video {
    outline: none;
    cursor: pointer;
    z-index: 1;
}