/*
 * Page-level storefront theme overrides.
 * This file is intentionally loaded after @stack('styles') because several
 * legacy screens define their own inline/page-local stylesheet blocks.
 */
[data-theme="dark"] {
    --page-surface: var(--theme-surface);
    --page-surface-muted: var(--theme-surface-muted);
    --page-text: var(--theme-text);
    --page-text-strong: var(--theme-text-strong);
    --page-text-muted: var(--theme-text-muted);
    --page-border: var(--theme-border);
}

[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-secondary,
[data-theme="dark"] .card,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .co-section-card,
[data-theme="dark"] .co-address-card,
[data-theme="dark"] .acc-table-header,
[data-theme="dark"] .acc-card,
[data-theme="dark"] .acc-panel,
[data-theme="dark"] .cart-table-wrap,
[data-theme="dark"] .cart-summary-card,
[data-theme="dark"] .cart-coupon-card {
    background-color: var(--page-surface) !important;
    color: var(--page-text) !important;
    border-color: var(--page-border) !important;
}

[data-theme="dark"] .bg-light .bg-light,
[data-theme="dark"] .bg-white .bg-white,
[data-theme="dark"] .bg-secondary .bg-secondary,
[data-theme="dark"] .co-section-card .bg-light,
[data-theme="dark"] .acc-table-header {
    background-color: var(--page-surface-muted) !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] [style*="color: #212529"],
[data-theme="dark"] [style*="color:#212529"],
[data-theme="dark"] [style*="color: #1f2b6c"],
[data-theme="dark"] [style*="color:#1f2b6c"],
[data-theme="dark"] .section-title,
[data-theme="dark"] .section-title span,
[data-theme="dark"] .breadcrumb-item,
[data-theme="dark"] .breadcrumb-item a,
[data-theme="dark"] .table,
[data-theme="dark"] .table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .co-section-title,
[data-theme="dark"] .co-vendor-name,
[data-theme="dark"] .acc-table-header,
[data-theme="dark"] .acc-table-header strong {
    color: var(--page-text) !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] .breadcrumb-item.active,
[data-theme="dark"] .co-address-detail,
[data-theme="dark"] .acc-muted,
[data-theme="dark"] small {
    color: var(--page-text-muted) !important;
}

[data-theme="dark"] .breadcrumb,
[data-theme="dark"] .breadcrumb.bg-light,
[data-theme="dark"] .shop-breadcrumb-bar {
    background-color: transparent !important;
}

[data-theme="dark"] .table thead th,
[data-theme="dark"] .table .thead-light th,
[data-theme="dark"] .table .thead-dark th,
[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light > th,
[data-theme="dark"] .table-light > td,
[data-theme="dark"] thead.bg-secondary,
[data-theme="dark"] thead.bg-secondary th {
    background-color: var(--page-surface-muted) !important;
    color: var(--page-text-strong) !important;
    border-color: var(--page-border) !important;
}

[data-theme="dark"] hr,
[data-theme="dark"] [style*="border-top: 1px solid #eaeaea"],
[data-theme="dark"] [style*="border: 1px solid #eaeaea"],
[data-theme="dark"] [style*="border: 1px solid #ddd"],
[data-theme="dark"] [style*="border: 1px solid #f3f4f6"] {
    border-color: var(--page-border) !important;
}

[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"] input.bg-light,
[data-theme="dark"] select.bg-light,
[data-theme="dark"] textarea.bg-light {
    background-color: var(--page-surface-muted) !important;
    color: var(--page-text) !important;
    border-color: var(--theme-border-strong) !important;
}

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

[data-theme="dark"] .co-shipping-selection-status,
[data-theme="dark"] .co-shipping-option,
[data-theme="dark"] .co-shipping-option--active,
[data-theme="dark"] .co-address-card--selected,
[data-theme="dark"] .co-vendor-ship-group,
[data-theme="dark"] .co-address-selected,
[data-theme="dark"] .co-address-card,
[data-theme="dark"] .co-mobile-bar,
[data-theme="dark"] .co-order-vendor-header,
[data-theme="dark"] .co-order-vendor-group,
[data-theme="dark"] .co-selected-courier,
[data-theme="dark"] .checkout-step,
[data-theme="dark"] .checkout-summary {
    background-color: var(--page-surface) !important;
    color: var(--page-text) !important;
    border-color: var(--page-border) !important;
}

[data-theme="dark"] .co-shipping-option,
[data-theme="dark"] .co-address-card,
[data-theme="dark"] .co-address-selected,
[data-theme="dark"] .co-vendor-ship-row,
[data-theme="dark"] .co-vendor-ship-details[open] .co-vendor-ship-summary {
    background-color: var(--page-surface) !important;
    color: var(--page-text) !important;
    border-color: var(--page-border) !important;
}

[data-theme="dark"] .co-shipping-option--active,
[data-theme="dark"] .co-address-card--selected {
    background-color: var(--page-surface-muted) !important;
    border-color: var(--theme-accent) !important;
    box-shadow: 0 0 0 3px var(--theme-focus) !important;
}

[data-theme="dark"] .co-address-selected-detail,
[data-theme="dark"] .co-selected-courier-name,
[data-theme="dark"] .co-step-label,
[data-theme="dark"] .co-mobile-bar-label {
    color: var(--page-text-muted) !important;
}

[data-theme="dark"] .co-address-selected-title strong,
[data-theme="dark"] .co-address-title strong,
[data-theme="dark"] .co-order-vendor-name,
[data-theme="dark"] .co-mobile-bar-amount {
    color: var(--page-text-strong) !important;
}

[data-theme="dark"] .co-order-item-name,
[data-theme="dark"] .co-order-item-price,
[data-theme="dark"] .co-coupon-header,
[data-theme="dark"] .cart-coupon-code {
    color: var(--page-text-strong) !important;
}

[data-theme="dark"] .co-order-item-variant,
[data-theme="dark"] .co-order-item-variant i {
    color: var(--page-text-muted) !important;
}

[data-theme="dark"] .co-vendor-ship-summary-main > strong,
[data-theme="dark"] .co-ship-change-label,
[data-theme="dark"] .co-vendor-ship-cost,
[data-theme="dark"] .co-vendor-ship-summary-side {
    color: var(--page-text) !important;
}

[data-theme="dark"] .cart-summary-row,
[data-theme="dark"] .cart-summary-total-row,
[data-theme="dark"] .cart-summary-row--vendor,
[data-theme="dark"] .cart-summary-row .text-muted,
[data-theme="dark"] .cart-summary-row small,
[data-theme="dark"] .co-vendor-label,
[data-theme="dark"] .co-vendor-ship-value,
[data-theme="dark"] .co-vendor-ship-cost-val,
[data-theme="dark"] .co-vendor-ship-method-label {
    color: var(--page-text) !important;
}

[data-theme="dark"] .cart-summary-total-row,
[data-theme="dark"] .co-vendor-ship-value,
[data-theme="dark"] .co-vendor-ship-cost-val {
    color: var(--page-text-strong) !important;
}

[data-theme="dark"] .cart-coupon-applied {
    background: var(--page-surface-muted) !important;
    border-color: var(--page-border) !important;
}

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

[data-theme="dark"] .pd-product-info,
[data-theme="dark"] .product-detail-info,
[data-theme="dark"] .product-detail-card,
[data-theme="dark"] .pd-info-box,
[data-theme="dark"] .bg-light.rounded,
[data-theme="dark"] .bg-light.p-3,
[data-theme="dark"] .bg-light.p-4,
[data-theme="dark"] .bg-light.p-5,
[data-theme="dark"] .bg-light.p-30 {
    background-color: var(--page-surface) !important;
    color: var(--page-text) !important;
    border-color: var(--page-border) !important;
}

[data-theme="dark"] .vendor-store-page .bg-light,
[data-theme="dark"] .store-filter,
[data-theme="dark"] .store-products-header,
[data-theme="dark"] .store-empty-state {
    background-color: var(--page-surface) !important;
    color: var(--page-text) !important;
    border-color: var(--page-border) !important;
}

[data-theme="dark"] .vendor-store-page h1,
[data-theme="dark"] .vendor-store-page h2,
[data-theme="dark"] .vendor-store-page h3,
[data-theme="dark"] .vendor-store-page h4,
[data-theme="dark"] .vendor-store-page h5,
[data-theme="dark"] .vendor-store-page h6,
[data-theme="dark"] .vendor-store-page strong {
    color: var(--page-text-strong) !important;
}

[data-theme="dark"] .payment-page .bg-light,
[data-theme="dark"] .payment-page .bg-secondary,
[data-theme="dark"] .order-page .bg-light,
[data-theme="dark"] .order-page .bg-secondary,
[data-theme="dark"] .account-page .bg-light,
[data-theme="dark"] .account-page .bg-secondary {
    background-color: var(--page-surface) !important;
    color: var(--page-text) !important;
}

[data-theme="dark"] .order-page .badge-light,
[data-theme="dark"] .order-page .badge-secondary {
    background-color: var(--page-surface-muted) !important;
    color: var(--page-text) !important;
    border: 1px solid var(--page-border) !important;
}

[data-theme="dark"] .order-page .text-muted,
[data-theme="dark"] .order-page .small,
[data-theme="dark"] .order-page p {
    color: var(--page-text-muted) !important;
}

[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-outline-dark,
[data-theme="dark"] .btn-outline-secondary {
    background-color: var(--page-surface-muted) !important;
    color: var(--page-text) !important;
    border-color: var(--page-border-strong, var(--theme-border-strong)) !important;
}

[data-theme="dark"] .btn-light:hover,
[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-outline-dark:hover,
[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--theme-primary) !important;
    color: var(--theme-on-primary) !important;
    border-color: var(--theme-primary) !important;
}

[data-theme="dark"] .vendor-status-page,
[data-theme="dark"] .vendor-status-page .info-card,
[data-theme="dark"] .vendor-status-page [style*="background: #f8f9fa"],
[data-theme="dark"] .vendor-status-page [style*="background:#f8f9fa"] {
    background-color: var(--page-surface) !important;
    color: var(--page-text) !important;
    border-color: var(--page-border) !important;
}

[data-theme="dark"] .vendor-status-page h1,
[data-theme="dark"] .vendor-status-page h2,
[data-theme="dark"] .vendor-status-page h3,
[data-theme="dark"] .vendor-status-page h4,
[data-theme="dark"] .vendor-status-page h5,
[data-theme="dark"] .vendor-status-page h6,
[data-theme="dark"] .vendor-status-page strong {
    color: var(--page-text-strong) !important;
}

@media (max-width: 767.98px) {
    [data-theme="dark"] .table-responsive,
    [data-theme="dark"] .cart-table-wrap,
    [data-theme="dark"] .checkout-summary {
        background-color: var(--page-surface) !important;
    }
}

/* Checkout address picker: keep every modal text layer readable above the global !important theme rules. */
[data-theme="dark"] .co-modal-address .modal-content,
[data-theme="dark"] .co-modal-address .modal-body,
[data-theme="dark"] .co-modal-address .modal-footer {
    color: var(--theme-text) !important;
}
[data-theme="dark"] .co-modal-address .modal-body {
    background-color: var(--theme-bg) !important;
}
[data-theme="dark"] .co-modal-address .modal-body > .text-muted,
[data-theme="dark"] .co-modal-address .modal-body > .text-muted strong {
    color: var(--theme-text-muted) !important;
}
[data-theme="dark"] .co-modal-address .co-address-card,
[data-theme="dark"] .co-modal-address .co-address-card-body {
    color: var(--theme-text) !important;
}
[data-theme="dark"] .co-modal-address .co-address-card-body > div:first-child strong {
    color: var(--theme-text-strong) !important;
}
[data-theme="dark"] .co-modal-address .co-address-card .text-muted,
[data-theme="dark"] .co-modal-address .co-address-card .text-muted * {
    color: var(--theme-text-muted) !important;
}
[data-theme="dark"] .co-modal-address .badge-light {
    background-color: var(--theme-surface-muted) !important;
    border: 1px solid var(--theme-border) !important;
    color: var(--theme-text-strong) !important;
}
[data-theme="dark"] .co-modal-address .modal-footer .btn-outline-primary {
    color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}
[data-theme="dark"] .co-modal-address .modal-footer .btn-outline-primary:hover,
[data-theme="dark"] .co-modal-address .modal-footer .btn-outline-primary:focus {
    background-color: var(--theme-primary) !important;
    color: #0b1220 !important;
}
