/*
 * Midnight Obsidian (dark theme)
 * Final visual layer loaded after page-local styles.
 * The goal is depth, calm contrast, and a consistent accent language—not a
 * flat inversion of the light theme.
 */
[data-theme="dark"] {
    color-scheme: dark;

    --theme-bg: #0a0f1c;
    --theme-surface: #111827;
    --theme-surface-raised: #182338;
    --theme-surface-muted: #1d2a42;
    --theme-text: #dbe4f0;
    --theme-text-strong: #f7f9fc;
    --theme-text-muted: #9aaac0;
    --theme-text-subtle: #71829b;
    --theme-border: rgba(148, 163, 184, .18);
    --theme-border-strong: rgba(148, 163, 184, .32);
    --theme-primary: #e1aaa3;
    --theme-primary-hover: #f0c0b8;
    --theme-on-primary: #1b2434;
    --theme-accent: #9aafff;
    --theme-focus: rgba(154, 175, 255, .28);
    --theme-overlay: rgba(3, 7, 18, .76);
    --theme-shadow-sm: 0 1px 2px rgba(0, 0, 0, .24), 0 8px 24px rgba(0, 0, 0, .16);
    --theme-shadow-md: 0 2px 4px rgba(0, 0, 0, .26), 0 16px 36px rgba(0, 0, 0, .24);
    --theme-shadow-lg: 0 4px 8px rgba(0, 0, 0, .3), 0 26px 70px rgba(0, 0, 0, .34);

    --shop-primary: #e1aaa3;
    --shop-primary-dark: #f0c0b8;
    --shop-accent: #9aafff;
    --shop-text: #dbe4f0;
    --shop-muted: #9aaac0;
    --shop-border: rgba(148, 163, 184, .18);
    --shop-bg: #0a0f1c;
    --shop-sidebar-bg: #111827;
    --shop-shadow-sm: 0 1px 2px rgba(0, 0, 0, .24), 0 8px 24px rgba(0, 0, 0, .16);
    --shop-shadow-md: 0 2px 4px rgba(0, 0, 0, .26), 0 16px 36px rgba(0, 0, 0, .24);
    --shop-shadow-lg: 0 4px 8px rgba(0, 0, 0, .3), 0 26px 70px rgba(0, 0, 0, .34);

    --amz-header-bg: #0a0f1c;
    --amz-header-bottom-bg: #111827;
    --amz-footer-bg: #0d1422;
    --amz-footer-bottom-bg: #080c16;
    --amz-search-btn-bg: #d99e98;
    --amz-search-btn-hover: #efb9b1;
}

[data-theme="dark"] html,
[data-theme="dark"] body {
    background: var(--theme-bg) !important;
    color: var(--theme-text) !important;
}

[data-theme="dark"] body {
    background-image:
        radial-gradient(circle at 8% -10%, rgba(120, 143, 255, .09), transparent 31rem),
        radial-gradient(circle at 92% 16%, rgba(225, 170, 163, .065), transparent 28rem) !important;
    background-attachment: fixed;
}

[data-theme="dark"] main {
    min-height: 42vh;
    background: transparent;
}

[data-theme="dark"] ::selection {
    background: rgba(225, 170, 163, .32);
    color: var(--theme-text-strong);
}

/* Page heroes: keep dark mode calm and remove the light-theme gradient strip. */
[data-theme="dark"] .page-hero-bar,
[data-theme="dark"] .vendors-page-hero {
    background: var(--theme-surface) !important;
    border-top: 0 !important;
    border-bottom: 1px solid var(--theme-border) !important;
    box-shadow: inset 0 1px 0 rgba(154, 175, 255, .06);
}

[data-theme="dark"] .page-hero-title,
[data-theme="dark"] .vendors-page-hero-title {
    color: var(--theme-text-strong) !important;
}

[data-theme="dark"] .page-hero-sub,
[data-theme="dark"] .vendors-page-hero-sub,
[data-theme="dark"] .vendors-page-stat-label {
    color: var(--theme-text-muted) !important;
}

[data-theme="dark"] .page-hero-icon,
[data-theme="dark"] .vendors-page-stat {
    background: var(--theme-surface-raised) !important;
    border: 1px solid var(--theme-border) !important;
    color: var(--theme-primary) !important;
}

/* Navigation: crisp, dark, and slightly luminous at the edges. */
[data-theme="dark"] .amz-header {
    background: linear-gradient(180deg, #080d18 0%, #0d1422 100%) !important;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .2);
}

[data-theme="dark"] .amz-header-bottom {
    background: #111827 !important;
    border-top: 1px solid rgba(148, 163, 184, .1);
}

[data-theme="dark"] .amz-nav-item:hover,
[data-theme="dark"] .amz-bottom-item:hover,
[data-theme="dark"] .amz-logo:hover {
    background: rgba(148, 163, 184, .1);
    border-color: rgba(148, 163, 184, .24);
}

[data-theme="dark"] .amz-search-input,
[data-theme="dark"] .amz-newsletter-input {
    background: #182338 !important;
    border-color: rgba(148, 163, 184, .2) !important;
    color: var(--theme-text-strong) !important;
}

[data-theme="dark"] .amz-search-input:focus,
[data-theme="dark"] .amz-newsletter-input:focus {
    background: #1d2a42 !important;
    border-color: var(--theme-accent) !important;
    box-shadow: 0 0 0 3px var(--theme-focus) !important;
}

[data-theme="dark"] .amz-search-btn,
[data-theme="dark"] .amz-signin-btn,
[data-theme="dark"] .amz-newsletter-btn {
    color: var(--theme-on-primary) !important;
    box-shadow: 0 5px 16px rgba(225, 170, 163, .16);
}

[data-theme="dark"] .amz-search-btn:hover,
[data-theme="dark"] .amz-signin-btn:hover,
[data-theme="dark"] .amz-newsletter-btn:hover {
    box-shadow: 0 8px 22px rgba(225, 170, 163, .25);
}

[data-theme="dark"] .amz-theme-toggle {
    background: rgba(154, 175, 255, .12) !important;
    border: 1px solid rgba(154, 175, 255, .3) !important;
    color: #c8d3ff !important;
}

[data-theme="dark"] .amz-theme-toggle:hover,
[data-theme="dark"] .amz-theme-toggle:focus-visible {
    background: rgba(154, 175, 255, .2) !important;
    border-color: rgba(154, 175, 255, .58) !important;
}

/* Layered surfaces: cards should sit above the page, not become black holes. */
[data-theme="dark"] .product-item,
[data-theme="dark"] .modern-prod-card,
[data-theme="dark"] .shop-sidebar-card,
[data-theme="dark"] .shop-results-bar,
[data-theme="dark"] .shop-empty-state,
[data-theme="dark"] .vendors-card,
[data-theme="dark"] .home-vendor-card,
[data-theme="dark"] .fs-card,
[data-theme="dark"] .cart-table-wrap,
[data-theme="dark"] .cart-summary-card,
[data-theme="dark"] .cart-coupon-card,
[data-theme="dark"] .co-section-card,
[data-theme="dark"] .co-address-card,
[data-theme="dark"] .acc-card,
[data-theme="dark"] .acc-panel,
[data-theme="dark"] .card {
    background: linear-gradient(145deg, var(--theme-surface-raised), var(--theme-surface)) !important;
    border: 1px solid var(--theme-border) !important;
    box-shadow: var(--theme-shadow-sm) !important;
}

[data-theme="dark"] .product-item:hover,
[data-theme="dark"] .modern-prod-card:hover,
[data-theme="dark"] .vendors-card:hover,
[data-theme="dark"] .home-vendor-card:hover,
[data-theme="dark"] .fs-card:hover {
    border-color: rgba(154, 175, 255, .34) !important;
    box-shadow: var(--theme-shadow-md) !important;
    transform: translateY(-3px);
}

[data-theme="dark"] .product-img,
[data-theme="dark"] .product-image,
[data-theme="dark"] .prod-image-wrap,
[data-theme="dark"] .vendors-card-top,
[data-theme="dark"] .home-vendor-top,
[data-theme="dark"] .fs-product-more {
    background: #0e1728 !important;
}

[data-theme="dark"] .product-img img,
[data-theme="dark"] .product-image img,
[data-theme="dark"] .prod-image-wrap img,
[data-theme="dark"] .vendors-logo,
[data-theme="dark"] .home-vendor-logo {
    filter: brightness(.94) saturate(.94);
}

[data-theme="dark"] .product-item:hover img,
[data-theme="dark"] .modern-prod-card:hover img {
    filter: brightness(1) saturate(1.02);
}

/* Headings, body copy, and links. */
[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"] .section-title,
[data-theme="dark"] .home-section-title,
[data-theme="dark"] .card-title,
[data-theme="dark"] .product-name,
[data-theme="dark"] .prod-title,
[data-theme="dark"] .fs-card-title {
    color: var(--theme-text-strong) !important;
}

[data-theme="dark"] p,
[data-theme="dark"] li,
[data-theme="dark"] .card-text,
[data-theme="dark"] .product-vendor-info,
[data-theme="dark"] .vendors-description,
[data-theme="dark"] .fs-card-meta {
    color: var(--theme-text) !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] .product-rating-count,
[data-theme="dark"] .vendors-owner-name,
[data-theme="dark"] .shop-results-range,
[data-theme="dark"] .shop-results-text {
    color: var(--theme-text-muted) !important;
}

[data-theme="dark"] a:not(.btn):not(.dropdown-item):not(.amz-bottom-nav-item):not(.amz-mobile-account-link) {
    color: var(--theme-accent);
}

[data-theme="dark"] a:not(.btn):not(.dropdown-item):not(.amz-bottom-nav-item):not(.amz-mobile-account-link):hover {
    color: #c5d0ff;
}

/* Product and storefront accents. */
[data-theme="dark"] .product-price,
[data-theme="dark"] .price-display,
[data-theme="dark"] .price-flash,
[data-theme="dark"] .cart-subtotal-cell,
[data-theme="dark"] .co-courier-name,
[data-theme="dark"] .co-vendor-shipping-header,
[data-theme="dark"] .co-vendor-ship-amount {
    color: var(--theme-primary) !important;
}

[data-theme="dark"] .product-action .btn,
[data-theme="dark"] .prod-action-btn,
[data-theme="dark"] .cart-qty-btn,
[data-theme="dark"] .co-qty-btn,
[data-theme="dark"] .shop-mobile-filter-btn,
[data-theme="dark"] .shop-reset-btn {
    background: var(--theme-surface-muted) !important;
    border-color: var(--theme-border-strong) !important;
    color: var(--theme-text) !important;
}

[data-theme="dark"] .product-action .btn:hover,
[data-theme="dark"] .prod-action-btn:hover,
[data-theme="dark"] .cart-qty-btn:hover,
[data-theme="dark"] .co-qty-btn:hover,
[data-theme="dark"] .shop-mobile-filter-btn:hover,
[data-theme="dark"] .shop-reset-btn:hover {
    background: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: var(--theme-on-primary) !important;
}

[data-theme="dark"] .shop-results-num,
[data-theme="dark"] .shop-empty-btn,
[data-theme="dark"] .co-step--active .co-step-icon,
[data-theme="dark"] .co-address-selected-icon {
    background: linear-gradient(135deg, #8f9fff, #596fc9) !important;
    color: #fff !important;
    box-shadow: 0 8px 22px rgba(89, 111, 201, .26);
}

/* Checkout: separate content surfaces with calm selected states. */
[data-theme="dark"] .co-shipping-option,
[data-theme="dark"] .co-address-card,
[data-theme="dark"] .co-address-selected,
[data-theme="dark"] .co-vendor-ship-group,
[data-theme="dark"] .co-vendor-ship-row,
[data-theme="dark"] .co-mobile-bar {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

[data-theme="dark"] .co-shipping-option--active,
[data-theme="dark"] .co-address-card--selected {
    background: linear-gradient(145deg, rgba(154, 175, 255, .16), rgba(154, 175, 255, .06)) !important;
    border-color: var(--theme-accent) !important;
    box-shadow: 0 0 0 3px rgba(154, 175, 255, .13), var(--theme-shadow-sm) !important;
}

[data-theme="dark"] .co-vendor-ship-details[open] .co-vendor-ship-summary,
[data-theme="dark"] .co-vendor-ship-summary:hover {
    background: rgba(154, 175, 255, .1) !important;
    color: var(--theme-text-strong) !important;
}

[data-theme="dark"] .co-primary-badge,
[data-theme="dark"] .co-free-badge {
    background: rgba(110, 231, 183, .14) !important;
    border: 1px solid rgba(110, 231, 183, .28);
    color: #8df0c6 !important;
}

[data-theme="dark"] .co-modal-address .modal-content,
[data-theme="dark"] .co-modal-address .modal-body,
[data-theme="dark"] .co-modal-address .modal-footer {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
}

/* Forms: reduce glare and make focus feel intentional. */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control,
[data-theme="dark"] .custom-select,
[data-theme="dark"] .shop-filter-select,
[data-theme="dark"] .shop-search-input,
[data-theme="dark"] .shop-price-input {
    background: #101a2b !important;
    border-color: var(--theme-border-strong) !important;
    color: var(--theme-text-strong) !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .custom-select:focus {
    background: #17243a !important;
    border-color: var(--theme-accent) !important;
    box-shadow: 0 0 0 3px var(--theme-focus) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] .form-control::placeholder {
    color: var(--theme-text-subtle) !important;
    opacity: 1 !important;
}

/* Empty states, tables, feedback and pagination. */
[data-theme="dark"] .shop-empty-icon,
[data-theme="dark"] .cart-empty-state,
[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light > th,
[data-theme="dark"] .table-light > td {
    background: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
[data-theme="dark"] .table-hover tbody tr:hover {
    background: rgba(154, 175, 255, .065) !important;
}

[data-theme="dark"] .pagination .page-link {
    background: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text) !important;
}

[data-theme="dark"] .pagination .page-item.active .page-link,
[data-theme="dark"] .pagination .page-link:hover {
    background: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: var(--theme-on-primary) !important;
}

[data-theme="dark"] .alert-success { background: rgba(16, 185, 129, .13) !important; border-color: rgba(110, 231, 183, .24) !important; color: #9af4cf !important; }
[data-theme="dark"] .alert-warning { background: rgba(245, 158, 11, .13) !important; border-color: rgba(251, 191, 36, .24) !important; color: #fbd38d !important; }
[data-theme="dark"] .alert-danger { background: rgba(244, 63, 94, .13) !important; border-color: rgba(253, 164, 175, .24) !important; color: #fecdd3 !important; }
[data-theme="dark"] .alert-info { background: rgba(59, 130, 246, .13) !important; border-color: rgba(147, 197, 253, .24) !important; color: #bfdbfe !important; }

/* Flash-sale and branded heroes keep their drama but lose light-mode glare. */
[data-theme="dark"] .fs-card-header.active-header { background: linear-gradient(135deg, rgba(244, 63, 94, .2), rgba(127, 29, 29, .28)) !important; }
[data-theme="dark"] .fs-card-header.upcoming-header { background: linear-gradient(135deg, rgba(59, 130, 246, .2), rgba(30, 58, 138, .3)) !important; }
[data-theme="dark"] .fs-card-header.ended-header { background: linear-gradient(135deg, #1c2738, #172033) !important; }
[data-theme="dark"] .fs-section-title { color: var(--theme-text-strong) !important; }

[data-theme="dark"] .shop-brand-hero,
[data-theme="dark"] .vendors-hero-box {
    box-shadow: var(--theme-shadow-md);
    border: 1px solid rgba(154, 175, 255, .18);
}

/* Footer depth and small-screen polish. */
[data-theme="dark"] .amz-footer {
    background: linear-gradient(180deg, #0d1422, #080c16) !important;
    border-top: 1px solid rgba(148, 163, 184, .12);
}

[data-theme="dark"] .amz-back-to-top:hover {
    background: #1a2940 !important;
}

[data-theme="dark"] .amz-social-link:hover {
    color: var(--theme-primary) !important;
}

@media (max-width: 991.98px) {
    [data-theme="dark"] .shop-filter-sidebar {
        background: var(--theme-surface) !important;
        border-right: 1px solid var(--theme-border);
        box-shadow: var(--theme-shadow-lg);
    }

    [data-theme="dark"] .mobile-filter-header,
    [data-theme="dark"] .shop-results-bar {
        background: var(--theme-surface-raised) !important;
        border-color: var(--theme-border) !important;
    }
}

@media (max-width: 575.98px) {
    [data-theme="dark"] .amz-header-top {
        background: #0a0f1c;
    }

    [data-theme="dark"] .product-item,
    [data-theme="dark"] .modern-prod-card,
    [data-theme="dark"] .fs-card {
        border-radius: 10px;
    }

    [data-theme="dark"] .shop-results-bar {
        box-shadow: none !important;
    }
}
