/* =========================================================
   PK Sparkle system theme support
   Follows the operating-system/browser preference automatically.
   Light mode remains the default; dark mode activates only when
   prefers-color-scheme: dark is reported by the device.
   ========================================================= */

:root { color-scheme: light; }

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --pk-clean-bg: #121012;
        --pk-clean-soft: #181518;
        --pk-clean-soft-2: #1e1a1d;
        --pk-clean-text: #f5f0f2;
        --pk-clean-muted: #b9afb3;
        --pk-clean-line: #393136;
        --pk-clean-brand: #e28cab;
        --pk-clean-brand-dark: #f0aec5;
        --pk-clean-accent: #ed9db9;
        --pk-clean-green: #65c98f;

        --ivory: #121012;
        --blush: #181518;
        --white: #1c181b;
        --dark: #f5f0f2;
        --muted: #b9afb3;
        --line: #393136;
        --rose: #d98aa7;
        --rose-dark: #efabc3;
    }

    html,
    body,
    main {
        background: #121012 !important;
        color: #f5f0f2 !important;
    }

    body { color-scheme: dark; }
    a { color: inherit; }

    /* Header and navigation */
    .top-strip {
        background: #171316 !important;
        color: #cbbfc4 !important;
        border-color: #342b30 !important;
    }
    .site-header {
        background: rgba(18,16,18,.97) !important;
        border-color: #393136 !important;
        color: #f5f0f2 !important;
    }
    .search input,
    .site-header .search input {
        background: #1d191c !important;
        color: #f5f0f2 !important;
        border-color: #453a40 !important;
    }
    .search input::placeholder { color: #92878c !important; }
    .search::before { color: #b7abb0 !important; }
    .search input:focus {
        border-color: #a35f78 !important;
        box-shadow: 0 0 0 3px rgba(226,140,171,.12) !important;
    }
    .site-header .nav a,
    .quick-nav a { color: #eee7ea !important; }
    .site-header .nav a:hover {
        background: #241e22 !important;
        color: #f0aec5 !important;
    }
    .login-signup-link { color: #f0aec5 !important; }
    .cart-icon-link,
    .mobile-menu-btn {
        background: #1d191c !important;
        color: #f5f0f2 !important;
        border-color: #453a40 !important;
    }
    .cart-icon-link:hover,
    .mobile-menu-btn:hover { background: #282126 !important; }
    .cart-count-pill { border-color: #121012 !important; }
    .quick-nav {
        background: #151214 !important;
        color: #f5f0f2 !important;
        border-color: #393136 !important;
    }
    .quick-nav a:hover {
        color: #f0aec5 !important;
        border-bottom-color: #e28cab !important;
    }
    .site-header .mobile-nav {
        background: #181518 !important;
        border-color: #3d3338 !important;
        box-shadow: 0 14px 30px rgba(0,0,0,.32) !important;
    }
    .site-header .mobile-nav a { border-color: #30282d !important; }

    /* Homepage */
    .marketplace-home,
    .clean-home,
    .market-hero-wrap,
    .marketplace-home .pk-offer-slider,
    .clean-home-section,
    .marketplace-home .market-row-card {
        background: #121012 !important;
    }
    .marketplace-home .pk-offer-slider-shell {
        background: #181518 !important;
        border-color: #393136 !important;
    }
    .marketplace-home .pk-offer-arrow {
        background: rgba(28,24,27,.94) !important;
        color: #f5f0f2 !important;
        border-color: #443940 !important;
        box-shadow: 0 4px 14px rgba(0,0,0,.28) !important;
    }
    .marketplace-home .pk-offer-dots button {
        background: rgba(28,24,27,.76) !important;
        border-color: rgba(245,240,242,.35) !important;
    }
    .market-hero-fallback {
        background: linear-gradient(90deg,rgba(18,16,18,.96),rgba(18,16,18,.66)),url('../images/home/home-beauty-jewellery.png') center right/cover no-repeat !important;
    }
    .market-hero-fallback p { color: #c4b8bd !important; }
    .clean-section-head,
    .marketplace-home .market-row-head,
    .pks-section-head { border-color: #393136 !important; }
    .clean-section-head h2,
    .marketplace-home .market-row-head h2,
    .clean-category-card strong,
    .clean-benefits strong,
    .marketplace-home .market-card-title,
    .marketplace-home .market-card-price strong {
        color: #f5f0f2 !important;
    }
    .clean-section-head p,
    .clean-category-card span,
    .marketplace-home .market-card-category,
    .marketplace-home .market-card-price small,
    .clean-benefits span { color: #aaa0a4 !important; }
    .clean-category-media,
    .marketplace-home .market-card-media {
        background: #1b181a !important;
        border-color: #393136 !important;
    }
    .marketplace-home .market-strip-item,
    .marketplace-home .market-strip-large .market-strip-item {
        background: #121012 !important;
        color: #f5f0f2 !important;
    }
    .clean-wholesale-banner {
        background: #1a1619 !important;
        border-color: #393136 !important;
    }
    .clean-wholesale-media { background: #201a1e !important; }
    .clean-btn-secondary {
        background: #1c181b !important;
        color: #f3ecef !important;
        border-color: #4a3f44 !important;
    }
    .clean-benefits {
        border-color: #393136 !important;
    }
    .clean-benefits > div { border-color: #393136 !important; }

    /* Shop / catalogue */
    .page-head,
    .page-head.shop-head,
    .shop-layout,
    .shop-layout > div {
        background: #121012 !important;
        color: #f5f0f2 !important;
    }
    .page-head.shop-head p { color: #b9afb3 !important; }
    .shop-layout .filters {
        background: #181518 !important;
        border-color: #393136 !important;
        color: #f5f0f2 !important;
    }
    .shop-layout .filters > a {
        color: #c9bec3 !important;
        border-color: #30292d !important;
    }
    .shop-layout .filters > a.active,
    .shop-layout .filters > a:hover { color: #f0aec5 !important; }
    .shop-layout .filters label { color: #b9afb3 !important; }
    .shop-layout .filters hr { border-color: #393136 !important; }
    .shop-layout .filters input,
    .shop-layout .filters select,
    input,
    select,
    textarea {
        background: #1d191c !important;
        color: #f5f0f2 !important;
        border-color: #453a40 !important;
    }
    input::placeholder,
    textarea::placeholder { color: #8f8489 !important; }
    select option { background: #1d191c; color: #f5f0f2; }
    .shop-layout .result-bar {
        background: #121012 !important;
        color: #f5f0f2 !important;
        border-color: #393136 !important;
    }
    .shop-layout .result-bar span { color: #aaa0a4 !important; }
    .store-product-card {
        background: #121012 !important;
        color: #f5f0f2 !important;
    }
    .store-product-media {
        background: #1a1719 !important;
        border-color: #393136 !important;
    }
    .store-product-card h3,
    .store-product-price strong { color: #f5f0f2 !important; }
    .store-product-card .store-product-category,
    .store-product-price small { color: #a99da2 !important; }
    .store-product-cta {
        background: #1b171a !important;
        color: #f0aec5 !important;
        border-color: #443940 !important;
    }
    .store-product-card:hover .store-product-cta {
        background: #261f23 !important;
        border-color: #65515a !important;
        color: #f4bed1 !important;
    }

    /* Product detail / reviews */
    .pks-product-page,
    .pks-product-page .product-detail,
    .pks-product-page .product-info,
    .pks-similar-section,
    .pks-detail-section,
    .pks-reviews-section,
    .product-detail,
    .product-info {
        background: #121012 !important;
        color: #f5f0f2 !important;
    }
    .pks-breadcrumb,
    .pks-breadcrumb a { color: #aaa0a4 !important; }
    .pks-product-page .product-main-image {
        background: #1a1719 !important;
        border-color: #393136 !important;
    }
    .product-thumb,
    .pks-product-page .product-thumb {
        background: #1a1719 !important;
        border-color: #393136 !important;
    }
    .pks-product-page .pks-price-panel {
        background: #121012 !important;
        border-color: #393136 !important;
    }
    .pks-product-page .pks-product-meta-chips span {
        background: #1c181b !important;
        color: #d9cfd3 !important;
        border-color: #3d3438 !important;
    }
    .pks-product-copy,
    .pks-save-line,
    .review-date { color: #b9afb3 !important; }
    .pks-wholesale-note,
    .pks-detail-card,
    .review-login-box,
    .review-locked-box,
    .pks-review-overview,
    .pks-review-form-card,
    .review-card {
        background: #191619 !important;
        color: #f5f0f2 !important;
        border-color: #393136 !important;
    }
    .pks-detail-copy,
    .pks-long-detail,
    .review-name { color: #f5f0f2 !important; }
    .pks-spec-row { border-color: #393136 !important; }
    .pks-spec-row span { color: #aaa0a4 !important; }
    .pks-spec-row strong { color: #f5f0f2 !important; }
    .pks-rating-track { background: #30282d !important; }
    .verified-badge {
        background: #322718 !important;
        color: #efc981 !important;
    }
    .review-as {
        background: #211b1e !important;
        border-color: #3d3338 !important;
    }

    /* Generic public cards, forms, carts and account pages */
    .section,
    .soft-bg,
    .wholesale-page,
    .contact-grid,
    .cart-list,
    .cart-total,
    .account-section {
        background-color: #121012 !important;
        color: #f5f0f2 !important;
    }
    .category-card,
    .feature-grid > div,
    .content-card,
    .form-card,
    .empty-card,
    .success-card,
    .detail-box,
    .account-card,
    .cart-layout,
    .cart-row {
        background: #191619 !important;
        color: #f5f0f2 !important;
        border-color: #393136 !important;
        box-shadow: none !important;
    }
    .muted,
    .category-card span,
    .feature-grid p,
    .cart-row span { color: #aaa0a4 !important; }
    .btn.secondary,
    .btn.light {
        background: #1c181b !important;
        color: #f5f0f2 !important;
        border-color: #473b41 !important;
    }
    table { background: #191619 !important; color: #f5f0f2 !important; }
    th,
    td { border-color: #3a3135 !important; }
    th { color: #b8adb2 !important; }
    .message-row td { background: #211b1e !important; color: #b9afb3 !important; }

    /* Footer */
    .footer.pk-premium-footer {
        background: #171416 !important;
        color: #f5f0f2 !important;
        border-color: #393136 !important;
    }
    .footer.pk-premium-footer h3,
    .footer.pk-premium-footer h4 { color: #f5f0f2 !important; }
    .footer.pk-premium-footer p,
    .footer.pk-premium-footer a { color: #b8adb2 !important; }
    .footer.pk-premium-footer a:hover { color: #f0aec5 !important; }
    .pk-footer-badges span {
        background: #211c1f !important;
        color: #bdb2b7 !important;
        border-color: #40363b !important;
    }
    .pk-social-icon {
        background: #211c1f !important;
        color: #f0aec5 !important;
        border-color: #493d43 !important;
    }
    .pk-social-icon:hover { background: #2d2529 !important; border-color: #6c5660 !important; }
    .pk-bottom-footer {
        background: #121012 !important;
        color: #91868b !important;
        border-color: #393136 !important;
    }

    /* Admin: follow system theme too */
    .admin-body,
    .admin-main {
        background: #121012 !important;
        color: #f5f0f2 !important;
    }
    .admin-sidebar {
        background: #0e0b0d !important;
        color: #f5f0f2 !important;
        border-right: 1px solid #30282d !important;
    }
    .admin-sidebar nav a { color: #d8cdd2 !important; }
    .admin-sidebar nav a:hover { background: #251e22 !important; color: #fff !important; }
    .admin-top { color: #f5f0f2 !important; }
    .admin-cards div,
    .admin-panel,
    .admin-login-card,
    .inventory-kpi,
    .permission-card {
        background: #191619 !important;
        color: #f5f0f2 !important;
        border-color: #393136 !important;
        box-shadow: none !important;
    }
    .admin-login-body { background: #121012 !important; }
    .admin-cards span,
    .inventory-kpi span,
    .inventory-kpi small,
    .inv-product-cell small,
    .invoice-toolbar small,
    .permission-card .muted { color: #aaa0a4 !important; }
    .admin-cards strong,
    .inventory-kpi strong,
    .sales-total,
    .permission-card legend,
    .permission-check { color: #f5f0f2 !important; }
    .inventory-note,
    .receipt-meta div,
    .gst-seller-strip > div,
    .empty-state {
        background: #211b1e !important;
        color: #d8cdd2 !important;
        border-color: #40363b !important;
    }
    .offline-item-row,
    .sale-summary-line { border-color: #393136 !important; }
    .offline-item-row .remove-line {
        background: #341c22 !important;
        color: #ff9eb0 !important;
    }
    .salesperson-code { background: #2a2024 !important; color: #e9bdad !important; }
    .role-badge.super { background: #392b17 !important; color: #f0c87c !important; border-color: #674e25 !important; }
    .role-badge.sub { background: #17283a !important; color: #9fc9f5 !important; border-color: #2b4b6b !important; }

    /* Keep GST invoice paper white for readability and printing. */
    .gst-invoice,
    .gst-invoice * { color-scheme: light; }
    .gst-invoice { background: #fff !important; color: #151515 !important; }
    .gst-invoice h1,
    .gst-invoice h2,
    .gst-invoice h3,
    .gst-invoice strong,
    .gst-invoice p,
    .gst-invoice span,
    .gst-invoice td,
    .gst-invoice th { color: #151515 !important; }
    .gst-invoice input,
    .gst-invoice select,
    .gst-invoice textarea { background: #fff !important; color: #151515 !important; }
    .gst-item-table th { background: #f5f2f0 !important; }
    .gst-words { background: #fafafa !important; }

    @media (max-width: 768px) {
        .site-header .mobile-nav { background: #181518 !important; }
    }
}
