/* Migrated from register.html and Dark Mode Fixes */
.form-section {
    background: var(--white);
    /* Uses var now */
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.form-section h3 {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    /* Uses var now */
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media(max-width: 600px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.file-upload {
    border: 2px dashed #cbd5e1;
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.file-upload:hover {
    border-color: var(--primary-color);
    background: #f0f9ff;
}

/* ENFORCE DARK MODE */
[data-theme="dark"] body {
    background-color: #0f172a !important;
    /* Unified dark BG */
}

[data-theme="dark"] .form-section {
    background-color: #0f172a !important;
    /* Same as body as requested */
    border: 1px solid #334155;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] label,
[data-theme="dark"] p,
[data-theme="dark"] span:not(.theme-icon) {
    color: #ffffff !important;
    /* Force all text white */
}

[data-theme="dark"] .file-upload {
    border-color: #334155;
    background: #1e293b;
    color: #fff;
}

[data-theme="dark"] .file-upload:hover {
    background: #334155;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

[data-theme="dark"] {
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --background-color: #0f172a;
    /* Main dark bg */
    --card-bg: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --white: #ffffff;
}

[data-theme="dark"] html,
[data-theme="dark"] body {
    background-color: #0f172a !important;
    min-height: 100vh;
    color: #ffffff !important;
}

:root {
    --primary-color: #1e293b;
    --primary-hover: #334155;
    --accent-color: #3b82f6;
    --background-color: #f8fafc;
    /* Light BG */
    --text-color: #0f172a;
    /* Dark Text */
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    /* New var for card backgrounds */
    --white: #ffffff;
    /* Restore missing variable */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* DARK MODE OVERRIDES */
/* Dark mode variables are already defined above. Removing conflicting block. */

/* Force some elements to keep specific colors if needed, but mostly use vars */
/* Body rule consolidated at top */

[data-theme="dark"] .card-panel,
[data-theme="dark"] .form-section,
[data-theme="dark"] .offer-panel,
[data-theme="dark"] .product-item,
[data-theme="dark"] .store-header,
[data-theme="dark"] .store-container,
[data-theme="dark"] .store-card,
[data-theme="dark"] .card-overlay-content,
[data-theme="dark"] .section-block,
[data-theme="dark"] .modal-container,
[data-theme="dark"] .cart-page-container {
    background: var(--card-bg);
    color: #ffffff;
    border-color: #334155;
}

[data-theme="dark"] .product-price,
[data-theme="dark"] .offer-price {
    color: #ffffff !important;
}

[data-theme="dark"] .card-overlay {
    background: rgba(15, 23, 42, 0.95);
    /* Darker backdrop */
}

/* STATUS BADGES (Email Verification) */
.status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-badge.verified {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-badge.unverified {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.verify-link {
    color: #2563eb !important;
    text-decoration: underline;
    margin-left: 5px;
    cursor: pointer;
}

/* Dark Mode Badges */
[data-theme="dark"] .status-badge.verified {
    background: #064e3b;
    /* Dark Green bg */
    color: #4ade80;
    /* Light Green text */
    border-color: #065f46;
}

[data-theme="dark"] .status-badge.unverified {
    background: #451a03;
    /* Dark Orange bg */
    color: #fdba74;
    /* Light Orange text */
    border-color: #7c2d12;
}

[data-theme="dark"] .verify-link {
    color: #60a5fa !important;
    /* Lighter blue */
}

/* Disabled Input Styling for Dark Mode */
[data-theme="dark"] input:disabled {
    background: #1e293b !important;
    color: #94a3b8 !important;
    /* Muted text */
    cursor: not-allowed;
    border-color: #334155;
    opacity: 0.7;
}

/* DASHBOARD SPECIFIC FIXES */
.dashboard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.dashboard-container .card-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    /* Override the 400px limit from generic .card-panel */
}

[data-theme="dark"] .card-panel {
    background: var(--card-bg);
}

/* Inputs in dashboard need to be visible */
[data-theme="dark"] .dashboard-container input:not([type="color"]):not([type="checkbox"]),
[data-theme="dark"] .dashboard-container select,
[data-theme="dark"] .dashboard-container textarea,
[data-theme="dark"] .modal-content input,
[data-theme="dark"] .modal-content textarea {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: #475569;
}

[data-theme="dark"] .product-table {
    background: #1e293b;
    color: #ffffff;
}

[data-theme="dark"] .product-table th,
[data-theme="dark"] .product-table td {
    border-bottom-color: #334155;
    color: #ffffff;
}

/* Bank Details Section which has Inline Styles originally */
[data-theme="dark"] div[style*="background: #fdf2f8"] {
    background: #4a044e !important;
    /* Dark pink/purple */
    border-color: #831843 !important;
}

[data-theme="dark"] div[style*="background: #f0f9ff"] {
    background: #0c4a6e !important;
    /* Dark blue */
    border-color: #075985 !important;
}

/* Modal Content */
[data-theme="dark"] .modal-content {
    background: #1e293b !important;
    color: #ffffff;
}

/* Size section inside modal */
[data-theme="dark"] #size-section,
[data-theme="dark"] div[style*="background: #f8fafc"] {
    background: #334155 !important;
    border-color: #475569 !important;
}

/* Sizes grid inside modal - light mode */
.sizes-grid-container {
    background: white;
    border: 1px solid #e2e8f0;
}

/* Sizes grid inside modal - dark mode */
[data-theme="dark"] .sizes-grid-container {
    background: #1e293b !important;
    border-color: #475569 !important;
}

/* Individual size item - light mode */
.size-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
}

.size-label {
    min-width: 35px;
    font-weight: 500;
    font-size: 0.85rem;
    color: #1e293b;
}

.size-stock {
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
}

/* Individual size item - dark mode */
[data-theme="dark"] .size-item {
    background: #334155 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .size-label {
    color: #ffffff !important;
}

[data-theme="dark"] .size-stock {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #ffffff !important;
}

/* Size section container - light mode */
.size-section-container {
    background: #f8fafc;
}

/* Size section container - dark mode */
[data-theme="dark"] .size-section-container {
    background: #334155 !important;
    border-color: #475569;
}

/* Weekly preview modal */
[data-theme="dark"] #weeklyPreviewModal>div {
    background: #1e293b !important;
    color: #ffffff !important;
}

[data-theme="dark"] #weeklyPreviewModal h2,
[data-theme="dark"] #weeklyPreviewModal p {
    color: #ffffff !important;
}

/* Select dropdowns in modal */
[data-theme="dark"] .modal-content select {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

/* Textarea in modal */
[data-theme="dark"] .modal-content textarea {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

/* Remove white backgrounds from input groups if they exist */
[data-theme="dark"] .input-group div[style*="background: #f8fafc"] {
    background: #334155 !important;
    border-color: #475569 !important;
}

[data-theme="dark"] .input-group span[style*="background: #f1f5f9"] {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}


/* Ensure icons in the card are dark or light appropriately */
[data-theme="dark"] .card-overlay-content .icon-btn,
[data-theme="dark"] #btn-wa>div,
[data-theme="dark"] #btn-call>div,
[data-theme="dark"] #btn-ig>div {
    background: #334155 !important;
    /* Override inline white bg */
    color: #ffffff !important;
    border-color: #475569;
}

[data-theme="dark"] #btn-wa span,
[data-theme="dark"] #btn-call span,
[data-theme="dark"] #btn-ig span,
[data-theme="dark"] .card-overlay-content .text-muted {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .store-name {
    color: #ffffff;
}

[data-theme="dark"] .close-overlay {
    background: #334155;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .close-overlay:hover {
    background: #1e293b;
}

[data-theme="dark"] .btn-ask,
[data-theme="dark"] .btn-review {
    color: #ffffff !important;
    border-color: #475569;
}

[data-theme="dark"] .btn-ask:hover,
[data-theme="dark"] .btn-review:hover {
    background-color: #334155;
    color: #ffffff !important;
}

[data-theme="dark"] .store-location {
    background: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .search-input {
    background: #020617;
    color: white;
    border-color: var(--border-color);
}

[data-theme="dark"] .navbar {
    background-color: #1e293b !important;
    /* Keep navbar darkish but distinct */
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .filter-chip {
    background: #1e293b;
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .icon-btn {
    background: #334155;
    color: white;
}

[data-theme="dark"] .detail-image-col {
    background: #334155;
    /* Slightly lighter than bg to pop image */
}

[data-theme="dark"] .modal-container,
[data-theme="dark"] .modal-overlay {
    background: #020617;
}

/* Ensure inputs in dark mode are readable */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #020617;
    color: white;
    border-color: var(--border-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 4rem;
    /* Added breathing room at bottom */
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.center-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    width: 100%;
    max-width: 300px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: #f1f5f9;
}

/* Landing Page */
.landing-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.landing-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* Forms */
.card-panel {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.input-group {
    margin-bottom: 1.25rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.input-group label {
    display: flex;
    /* Use flex to align badge */
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
    min-height: 21px;
    /* Ensure consistent height even if badge is missing */
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: #f8fafc;
    margin-top: auto;
    /* Ensure bottom alignment */
    height: 45px;
    /* Force fixed height for alignment */
}

/* Fix for giant radio/checkboxes inheriting 100% width/height */
.input-group input[type="radio"],
.input-group input[type="checkbox"] {
    width: auto;
    height: auto;
    margin-top: 0;
}

/* Specific rule for custom phone wrappers to match standard inputs */
.input-group .phone-wrapper,
.input-group .phone-input-group {
    width: 100%;
    margin-top: auto;
    height: 45px;
    /* Match standard input height */
    box-sizing: border-box;
}

/* STORE & OVERLAY STYLES (NEW) */
.store-container {
    width: 100%;
    /* Full width */
    max-width: 100%;
    /* Full width */
    /* margin: 0 auto; Remove center constraint for full usage */
    background: white;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    padding-bottom: 2rem;
}

/* 1. HEADER (3 Columns) */
.store-header {
    background: white;
    color: var(--text-color);
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    position: relative;
    z-index: 100;
}

/* Header Left: Logo + Info + Toggle */
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-brand-info h1 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.header-brand-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-toggle-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-top: 0.25rem;
    position: relative;
    z-index: 50;
}

/* Header Right: Actions */
.header-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    border: none;
    text-decoration: none;
}

.icon-btn:hover {
    background: #e2e8f0;
}

/* Mobile Header Adjustments */
@media (max-width: 600px) {
    .store-header {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        height: auto;
        padding: 1rem;
    }

    .header-left {
        flex-direction: column;
        text-align: center;
    }

    /* Spacer div */
    .store-header>div:nth-child(2) {
        display: none;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 1rem;
    }
}

/* Logo Fix: Prevent squashing */
.header-left>div:first-child {
    flex-shrink: 0;
    aspect-ratio: 1/1;
}

/* 2. SEARCH BAR */
.search-container {
    padding: 1.5rem;
    max-width: 1200px;
    /* Match product grid max-width */
    margin: 1rem auto 0 auto;
    position: relative;
    z-index: 10;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    background: #ffffff;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* 3. OFFER PANEL */
/* Old offer-panel block removed */

.offer-content {
    flex: 1;
    z-index: 2;
    padding-right: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.offer-type {
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.offer-desc {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.offer-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.btn-add-offer {
    background: #111827;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.offer-panel {
    background: #ffffff;
    /* Unified White Background */
    border-radius: 1rem;
    padding: 0;
    /* Padding moved to inner */
    display: flex;
    justify-content: center;
    /* Center the inner container */
    align-items: center;
    margin: 2rem auto;
    width: calc(100% - 3rem);
    max-width: 1200px;
    height: 300px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.offer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 3rem;
    /* Content padding */
    transition: opacity 0.3s ease-in-out;
}

.offer-inner.fade-out {
    opacity: 0;
}

/* Navigation Buttons */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #64748b;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.carousel-nav:hover {
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    color: #1e293b;
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav.prev {
    left: 1rem;
}

.carousel-nav.next {
    right: 1rem;
}

/* Dots */
.carousel-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.dot.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

/* On mobile, stack or smaller height */
@media (max-width: 768px) {
    .offer-panel {
        height: auto;
        /* flex-direction irrelevant for panel now, controlled by offer-inner */
    }

    .offer-inner {
        flex-direction: row;
        /* Horizontal layout */
        padding: 0 1rem;
        text-align: left;
        padding-bottom: 0;
        align-items: center;
        gap: 0.5rem;
    }

    .offer-content {
        padding: 1rem 0;
        text-align: left;
        align-items: flex-start;
        flex: 1;
        /* Take remaining space */
    }

    .offer-image {
        width: 110px;
        /* Fixed width */
        max-width: 40%;
        height: 110px;
        /* Matching height */
        object-fit: contain;
    }

    .carousel-nav {
        /* On mobile maybe hide arrows or make them smaller? */
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

.offer-image {
    width: auto;
    max-width: 50%;
    height: 90%;
    object-fit: contain;
    z-index: 1;
    background: transparent;
    /* No separate bg */
    padding: 0;
}

/* 4. FILTERS */
.filters-container {
    max-width: 1200px;
    margin: 0 auto 1.5rem auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border-radius: 2rem;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.filter-chip:hover {
    background: #e2e8f0;
}

.filter-chip.active {
    background: #111827;
    /* Dark like 'Todos' in image */
    color: white;
}

/* 5. PRODUCT GRID */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 0 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.product-item {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Stretch to fill grid cell */
    justify-content: space-between;
}

/* Fix for direct image child as generated by JS */
.product-item>div>img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info {
    padding: 1rem;
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
}

.out-of-stock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 10;
}

.product-item.out-of-stock {
    opacity: 0.8;
}


/* OVERLAY (Fixed Modal - Contact) */
.card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5000;
    display: none;
    justify-content: center;
    align-items: center;
    /* backdrop-filter: blur(4px); Removed to prevent render glitches */
}

.card-overlay.active {
    display: flex !important;
    opacity: 1;
}

.card-overlay-content {
    background: white;
    width: 100%;
    height: 100%;
    max-width: 450px;
    max-height: 100%;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .card-overlay-content {
        height: auto;
        max-height: 90vh;
        border-radius: 1rem;
    }
}

.overlay-header {
    height: 150px;
    background-color: var(--primary-color);
    position: relative;
}

.close-overlay {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    transition: transform 0.2s;
}

.close-overlay:hover {
    transform: scale(1.1);
}

/* PRODUCT DETAIL MODAL (NEW FULL PAGE FEEL) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8fafc;
    /* Full opaque background */
    z-index: 3000;
    overflow-y: auto;
    display: none;
    /* JS Toggles this */
    padding-bottom: 2rem;
}

.modal-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #f8fafc;
    min-height: 100vh;
    padding: 1rem;
    position: relative;
}

.close-modal {
    position: fixed;
    /* Fixed so it follows scroll */
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 3001;
    /* Above everything */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 2rem;
}

@media (min-width: 768px) {
    .product-detail-layout {
        grid-template-columns: 1fr 1fr;
        padding-top: 4rem;
    }
}

.detail-image-col {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.detail-main-img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.detail-info-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
}

.description-text {
    color: var(--text-muted);
    line-height: 1.6;
}

.cart-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.qty-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.qty-selector button {
    background: #f1f5f9;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
}

.qty-selector span {
    padding: 0 1rem;
    font-weight: 600;
}

.btn-add-cart-large {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.section-block {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
}

.btn-ask,
.btn-review {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
}

.hidden-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
}

.btn-submit {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
}

/* 3D Flip Animation */
.flip-container {
    perspective: 1000px;
    width: 100px;
    height: 100px;
    margin: 0 auto;
    cursor: pointer;
}

.flip-container.flipped .flipper {
    transform: rotateY(180deg);
}

.flipper {
    transition: 0.6s;
    transform-style: preserve-3d;
    position: relative;
    width: 100%;
    height: 100%;
}

.front,
.back {
    backface-visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.front {
    z-index: 2;
    transform: rotateY(0deg);
}

.back {
    transform: rotateY(180deg);
}

/* DARK MODE BUTTON FIXES */
/* DARK MODE BUTTON FIXES */
[data-theme="dark"] .btn-primary {
    background-color: #1e293b !important;
    /* Lighter background for visibility */
    color: #ffffff !important;
    border: 1px solid #94a3b8;
    /* Bright border to make it pop */
}

[data-theme="dark"] .btn-primary:hover {
    background-color: #334155 !important;
}

/* ... existing styles ... */

[data-theme="dark"] .btn-outline {
    background-color: transparent;
    color: #ffffff;
    border-color: #94a3b8;
    /* Bright border */
}

[data-theme="dark"] .btn-outline:hover {
    background-color: #334155;
    color: #ffffff;
}

[data-theme="dark"] a[href="/register.html"] {
    color: #ffffff !important;
    text-decoration: underline;
}

/* CART PAGE STYLES */
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background: white;
    color: #0f172a;
    outline: none;
}

.phone-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    overflow: hidden;
    background: white;
}

.phone-prefix {
    background: #f8fafc;
    padding: 0.75rem;
    border-right: 1px solid #cbd5e1;
    color: #475569;
    font-weight: 500;
    font-size: 0.9rem;
    user-select: none;
}

.phone-input-group input {
    border: none;
    padding: 0.75rem;
    flex: 1;
    outline: none;
    width: 100%;
}

.delivery-options-container {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.delivery-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

[data-theme="dark"] .back-link {
    color: #cedebd !important;
}

[data-theme="dark"] .back-link:hover {
    color: #ffffff !important;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .phone-input-group,
[data-theme="dark"] .phone-input-group input,
[data-theme="dark"] #checkout-payment,
[data-theme="dark"] .delivery-options-container {
    background: #334155;
    border-color: #475569;
    color: #ffffff;
}

[data-theme="dark"] .phone-prefix {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

[data-theme="dark"] .delivery-option span {
    color: #ffffff;
}


/* CART ITEM STYLES */
.cart-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

[data-theme="dark"] .cart-item {
    background: #1e293b;
    border-color: #475569;
}

[data-theme="dark"] .cart-item h3,
[data-theme="dark"] .cart-item p,
[data-theme="dark"] .cart-item div,
[data-theme="dark"] .cart-item span {
    color: #ffffff !important;
}

/* Specific fix for text muted inside cart item in dark mode */
[data-theme="dark"] .cart-item .text-muted,
[data-theme="dark"] .cart-item div[style*="text-muted"] {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .cart-item .qty-selector {
    border-color: #475569 !important;
}

[data-theme="dark"] .qty-selector button {
    background: #334155;
    color: #ffffff;
    border-color: #475569;
}

/* DARK MODE STOCK BADGE FIX */
[data-theme="dark"] .stock-badge.in-stock {
    background-color: #dcfce7 !important;
    /* Keep light green */
    color: #166534 !important;
    /* Force dark green text */
    border: 1px solid #bbf7d0;
}

[data-theme="dark"] .stock-badge.out-stock {
    background-color: #fee2e2 !important;
    /* Keep light red */
    color: #991b1b !important;
    /* Force dark red text */
    border: 1px solid #fecaca;
}

/* Order Details Box */
.order-details-box {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    color: #334155;
}

.order-comments-separator {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #cbd5e1;
}

[data-theme="dark"] .order-details-box {
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .order-details-box strong {
    color: #fff;
}

[data-theme="dark"] .order-details-box div {
    color: #f1f5f9;
}

[data-theme="dark"] .order-comments-separator {
    border-top: 1px dashed #475569;
}

/* Checkout Success Modals */
.checkout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.checkout-modal-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    max-width: 90%;
    width: 400px;
    text-align: center;
    color: #334155;
}

.checkout-modal-box h2 {
    color: #166534;
    margin-bottom: 0.5rem;
}

.checkout-modal-box p {
    color: #64748b;
    margin-bottom: 1.5rem;
}

.checkout-modal-details {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #334155;
    margin-bottom: 1rem;
}

/* Dark Mode Overrides */
[data-theme="dark"] .checkout-modal-box {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
}

[data-theme="dark"] .checkout-modal-box h2 {
    color: #4ade80;
}

[data-theme="dark"] .checkout-modal-box p {
    color: #cbd5e1;
}

[data-theme="dark"] .checkout-modal-details {
    background: #0f172a;
    color: #cbd5e1;
    border: 1px solid #334155;
}

[data-theme="dark"] .checkout-modal-details strong {
    color: #fff;
}

/* Dark Mode Inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #334155 !important;
    color: #ffffff !important;
    border: 1px solid #475569 !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #94a3b8 !important;
}

/* Payment Settings Box */
.payment-settings-box {
    background: #f0f9ff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #bae6fd;
    margin-bottom: 1rem;
    color: #0369a1;
}

.payment-link {
    color: #0369a1;
    text-decoration: underline;
    font-weight: 600;
}

[data-theme="dark"] .payment-settings-box {
    background: #0c4a6e;
    /* Darker blue bg */
    border-color: #075985;
    color: #bae6fd;
    /* Light text */
}

[data-theme="dark"] .payment-link {
    color: #38bdf8 !important;
    /* Bright Sky Blue */
}

/* Size Badge Styling */
.size-badge {
    color: #3b82f6;
    font-size: 0.75rem;
    background: #eff6ff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    display: inline-block;
}

[data-theme="dark"] .size-badge {
    background: #1e293b !important;
    color: #60a5fa !important;
    border: 1px solid #334155 !important;
}