/* Theme (light/dark), page loader, toggle — load after style.css */

/* -------------------------------------------------------------------------- */
/* Page loader */
/* -------------------------------------------------------------------------- */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--loader-bg, rgba(248, 250, 252, 0.97));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}

html[data-theme="dark"] .page-loader {
    --loader-bg: rgba(15, 23, 42, 0.96);
}

html.is-loading .page-loader {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s ease, visibility 0s linear 0s;
}

.page-loader__panel {
    text-align: center;
    padding: 2rem 2.5rem;
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .page-loader__panel {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(129, 140, 248, 0.25);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.page-loader__mark {
    width: 44px;
    height: 44px;
    margin: 0 auto 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
}

.page-loader__rings {
    position: relative;
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
}

.page-loader__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #6366f1;
    border-right-color: rgba(99, 102, 241, 0.35);
    animation: page-loader-spin 0.85s linear infinite;
}

.page-loader__ring:nth-child(2) {
    inset: 6px;
    border-top-color: #a855f7;
    animation-duration: 1.1s;
    animation-direction: reverse;
}

html.reduce-motion .page-loader__ring {
    animation: none;
    border-top-color: #6366f1;
    opacity: 0.6;
}

@keyframes page-loader-spin {
    to { transform: rotate(360deg); }
}

.page-loader__label {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #64748b;
}

html[data-theme="dark"] .page-loader__label {
    color: #94a3b8;
}

/* -------------------------------------------------------------------------- */
/* Theme toggle */
/* -------------------------------------------------------------------------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.theme-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.theme-toggle:active {
    transform: scale(0.96);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

.theme-toggle__moon {
    display: none;
}

html[data-theme="light"] .theme-toggle__sun {
    display: none;
}

html[data-theme="light"] .theme-toggle__moon {
    display: block;
}

html[data-theme="dark"] .theme-toggle__sun {
    display: block;
}

html[data-theme="dark"] .theme-toggle__moon {
    display: none;
}

.admin-theme-toggle {
    margin-left: auto;
    margin-right: 8px;
}

/* -------------------------------------------------------------------------- */
/* Dark theme — global tokens (wallet, auth, profile, …) */
/* -------------------------------------------------------------------------- */
html[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-border: #334155;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-primary: #818cf8;
    --color-primary-hover: #a5b4fc;
    --color-primary-light: rgba(99, 102, 241, 0.18);
    --color-success: #34d399;
    --color-success-bg: rgba(6, 78, 59, 0.45);
    --color-error: #f87171;
    --color-error-bg: rgba(127, 29, 29, 0.35);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .site-header {
    background: rgba(15, 23, 42, 0.92);
    border-bottom-color: #334155;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .site-brand,
html[data-theme="dark"] .site-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .site-brand:hover {
    color: #a5b4fc;
}

html[data-theme="dark"] .site-nav a {
    color: #94a3b8;
}

html[data-theme="dark"] .site-nav a:hover {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.15);
}

html[data-theme="dark"] .site-nav a.nav-wallet {
    color: #c7d2fe;
}

html[data-theme="dark"] .site-header-catalog {
    color: #94a3b8;
}

html[data-theme="dark"] .site-header-catalog:hover {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.15);
}

html[data-theme="dark"] .site-nav-toggle {
    background: #1e293b;
    border-color: #475569;
}

html[data-theme="dark"] .site-nav-toggle__bar {
    background: #e2e8f0;
}

html[data-theme="dark"] .site-nav-toggle:hover {
    background: #334155;
    border-color: #6366f1;
}

html[data-theme="dark"] .site-nav {
    border-top-color: #334155;
}

html[data-theme="dark"] .site-footer {
    border-top-color: #334155;
    color: #94a3b8;
}

html[data-theme="dark"] .site-footer a {
    color: #a5b4fc;
}

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

html[data-theme="dark"] .theme-toggle:hover {
    background: #334155;
    border-color: #818cf8;
    color: #e2e8f0;
}

/* -------------------------------------------------------------------------- */
/* Light theme — marketing + catalog (page-reseller-index) */
/* -------------------------------------------------------------------------- */
html[data-theme="light"] body.page-reseller-index {
    background-color: #f1f5f9;
    background-image:
        radial-gradient(ellipse 90% 55% at 10% 0%, rgba(99, 102, 241, 0.14), transparent 52%),
        radial-gradient(ellipse 80% 50% at 95% 10%, rgba(168, 85, 247, 0.1), transparent 48%),
        radial-gradient(ellipse 60% 45% at 90% 95%, rgba(34, 211, 238, 0.08), transparent 50%),
        linear-gradient(175deg, #f8fafc 0%, #f1f5f9 45%, #eef2ff 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: 120% 100%, 110% 100%, 100% 100%, 100% 100%;
    background-position: top left, top right, bottom right, center;
}

html[data-theme="light"] body.page-reseller-index::before {
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
    -webkit-mask-image: radial-gradient(ellipse 90% 75% at 50% 40%, #000 0%, transparent 75%);
    mask-image: radial-gradient(ellipse 90% 75% at 50% 40%, #000 0%, transparent 75%);
}

html[data-theme="light"] body.page-reseller-index::after {
    background:
        radial-gradient(ellipse 100% 50% at 50% -5%, rgba(255, 255, 255, 0.9), transparent 55%),
        radial-gradient(ellipse 80% 60% at 50% 110%, rgba(241, 245, 249, 0.95), transparent 55%);
}

html[data-theme="light"] body.page-reseller-index .site-header {
    background: rgba(255, 255, 255, 0.88);
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] body.page-reseller-index .site-header .site-title,
html[data-theme="light"] body.page-reseller-index .site-header .site-brand {
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .site-header .site-nav a {
    color: #475569;
}

html[data-theme="light"] body.page-reseller-index .site-header .site-nav a.nav-wallet {
    color: #4f46e5;
}

html[data-theme="light"] body.page-reseller-index .site-header .site-nav a:hover {
    color: #4338ca;
    background: rgba(99, 102, 241, 0.1);
}

html[data-theme="light"] body.page-reseller-index .site-header-catalog {
    color: #475569;
}

html[data-theme="light"] body.page-reseller-index .site-header-catalog:hover {
    color: #4338ca;
    background: rgba(99, 102, 241, 0.1);
}

html[data-theme="light"] body.page-reseller-index .site-nav-toggle {
    background: #fff;
    border-color: #e2e8f0;
}

html[data-theme="light"] body.page-reseller-index .site-nav-toggle__bar {
    background: #334155;
}

html[data-theme="light"] body.page-reseller-index .site-nav {
    border-top-color: #e2e8f0;
}

html[data-theme="light"] body.page-reseller-index .page-title,
html[data-theme="light"] body.page-reseller-index h1,
html[data-theme="light"] body.page-reseller-index h2 {
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .reseller-category-heading {
    border-bottom-color: rgba(79, 70, 229, 0.35);
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .card,
html[data-theme="light"] body.page-reseller-index .reseller-product-grid,
html[data-theme="light"] body.page-reseller-index .reseller-product-card {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] body.page-reseller-index .reseller-product-card__body,
html[data-theme="light"] body.page-reseller-index .reseller-product-card__title {
    color: #1e293b;
}

html[data-theme="light"] body.page-reseller-index .reseller-product-card__pill {
    background: #eef2ff;
    color: #3730a3;
}

html[data-theme="light"] body.page-reseller-index .reseller-product-card__pill--stock {
    background: #f1f5f9;
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .text-muted {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .reseller-product-card__login-btn {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

html[data-theme="light"] body.page-reseller-index .reseller-product-card__login-btn:hover {
    background: #e2e8f0;
    color: #4338ca;
}

html[data-theme="light"] body.page-reseller-index .reseller-toolbar .reseller-search,
html[data-theme="light"] body.page-reseller-index .reseller-toolbar .reseller-category-select {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .reseller-toolbar .reseller-category-label {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .reseller-view-more-wrap {
    background: #f8fafc;
    border-top-color: #e2e8f0;
}

html[data-theme="light"] body.page-reseller-index .reseller-auth-prompt {
    background: #eef2ff;
    border-color: rgba(99, 102, 241, 0.25);
    color: #334155;
}

html[data-theme="light"] body.page-reseller-index .reseller-auth-prompt a {
    color: #4f46e5;
}

html[data-theme="light"] body.page-reseller-index .site-footer {
    border-top-color: #e2e8f0;
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .site-footer a {
    color: #4f46e5;
}

html[data-theme="light"] body.page-reseller-index .alert {
    border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] body.page-reseller-index .alert-success {
    background: #ecfdf5;
    color: #065f46;
}

html[data-theme="light"] body.page-reseller-index .alert-error {
    background: #fef2f2;
    color: #991b1b;
}

html[data-theme="light"] body.page-reseller-index .reseller-product-card__form .qty-input {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .catalog-page-intro {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .catalog-back__link {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .catalog-back__link:hover {
    color: #4338ca;
}

/* Landing sections — light */
html[data-theme="light"] body.page-reseller-index .landing-eyebrow {
    color: #4f46e5;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__title {
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__lead {
    color: #475569;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] body.page-reseller-index .landing-hero__card--main {
    background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
}

html[data-theme="light"] body.page-reseller-index .landing-hero__card-label {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__card-title {
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__card-text {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__metric-value {
    color: #4338ca;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__metric-label {
    color: #94a3b8;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__card--accent {
    background: rgba(238, 242, 255, 0.95);
    border-color: rgba(99, 102, 241, 0.25);
}

html[data-theme="light"] body.page-reseller-index .landing-hero__pill {
    color: #4338ca;
}

html[data-theme="light"] body.page-reseller-index .landing-hero__accent-text {
    color: #334155;
}

html[data-theme="light"] body.page-reseller-index .landing-section-title {
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .landing-section-sub {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .landing-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] body.page-reseller-index .landing-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
}

html[data-theme="light"] body.page-reseller-index .landing-card__icon {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

html[data-theme="light"] body.page-reseller-index .landing-card__title {
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .landing-card__text {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .landing-steps {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] body.page-reseller-index .landing-step__num {
    color: #fff;
}

html[data-theme="light"] body.page-reseller-index .landing-step__title {
    color: #0f172a;
}

html[data-theme="light"] body.page-reseller-index .landing-step__desc {
    color: #64748b;
}

html[data-theme="light"] body.page-reseller-index .landing-hero {
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

/* -------------------------------------------------------------------------- */
/* Admin — dark theme */
/* -------------------------------------------------------------------------- */
html[data-theme="dark"] .admin-sidebar {
    background: #0f172a;
    border-right: 1px solid #1e293b;
}

html[data-theme="dark"] .admin-header {
    background: #1e293b;
    border-bottom-color: #334155;
    color: #f1f5f9;
}

html[data-theme="dark"] .admin-content {
    background: #0f172a;
    color: #e2e8f0;
}

html[data-theme="dark"] .admin-page-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .admin-card {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .admin-card-desc {
    color: #94a3b8;
}

html[data-theme="dark"] .admin-table th {
    background: #0f172a;
    color: #cbd5e1;
}

html[data-theme="dark"] .admin-table td {
    border-bottom-color: #334155;
    color: #e2e8f0;
}

html[data-theme="dark"] .admin-ref {
    background: #0f172a;
    color: #cbd5e1;
}

html[data-theme="dark"] .form-control {
    background: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
}

html[data-theme="dark"] .form-control:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}
