/* assets/css/theme-switcher.css */

.theme-switcher-wrapper {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 99999;
    font-family: var(--font-ar), sans-serif;
}

.theme-switcher-btn {
    width: 45px;
    height: 45px;
    border-radius: 0 8px 8px 0; /* Flat on the left edge */
    background: var(--accent-primary);
    color: white;
    border: none;
    box-shadow: 4px 0 15px var(--accent-glow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    outline: none;
}

.theme-switcher-btn:hover {
    width: 55px; /* Expands slightly when hovered */
}

.theme-switcher-panel {
    position: absolute;
    top: -150px; /* Center relative to button roughly */
    left: 60px; /* Appear next to the button */
    width: 280px;
    background: var(--bg-surface-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom left;
}

.theme-switcher-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ts-section {
    margin-bottom: 20px;
}

.ts-section:last-child {
    margin-bottom: 0;
}

.ts-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: block;
}

.ts-modes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ts-mode-btn {
    flex: 1 1 calc(33.333% - 10px);
    padding: 8px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
}

.ts-mode-btn:hover, .ts-mode-btn.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-glow);
}

.ts-colors {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ts-color-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.ts-color-btn:hover {
    transform: scale(1.1);
}

.ts-color-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

/* Colors definition */
.ts-c-amber { background: #f59e0b; }
.ts-c-emerald { background: #10b981; }
.ts-c-rose { background: #f43f5e; }
.ts-c-cyan { background: #06b6d4; }
.ts-c-indigo { background: #6366f1; }
.ts-c-violet { background: #8b5cf6; }
.ts-c-orange { background: #f97316; }
.ts-c-black { background: #000000; border: 1px solid #333; }
.ts-c-white { background: #ffffff; border: 1px solid #ccc; }

/* Themes definition */
body.theme-grayscale > *:not(.theme-switcher-wrapper) {
    filter: grayscale(100%);
}

body.theme-grayscale {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.85);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: rgba(0, 0, 0, 0.08);

    /* Index.php Landing Page Overrides */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.08);
}

body.theme-light {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.85);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: rgba(0, 0, 0, 0.08);

    /* Index.php Landing Page Overrides */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.08);
}

body.theme-slate {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-glass: rgba(30, 41, 59, 0.85);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: rgba(255, 255, 255, 0.08);

    /* Index.php Landing Page Overrides */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
}

body.theme-midnight {
    --bg-base: #000000;
    --bg-surface: #111111;
    --bg-surface-glass: rgba(17, 17, 17, 0.85);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border-color: rgba(255, 255, 255, 0.1);

    /* Index.php Landing Page Overrides */
    --bg-primary: #000000;
    --bg-secondary: #111111;
    --bg-card: #111111;
    --text-muted: #71717a;
    --border: rgba(255, 255, 255, 0.1);
}

body.theme-paper {
    --bg-base: #fbf0d9;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.85);
    --text-primary: #333333;
    --text-secondary: #5f4b32;
    --border-color: rgba(95, 75, 50, 0.15);

    /* Index.php Landing Page Overrides */
    --bg-primary: #fbf0d9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-muted: #8b7355;
    --border: rgba(95, 75, 50, 0.15);
}

/* Accent Color Variations */
body.accent-indigo {
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --accent: #6366f1; /* index.php specific */
    --accent-light: #818cf8;
    --accent-secondary: #8b5cf6;
}

body.accent-emerald {
    --accent-primary: #10b981;
    --accent-primary-hover: #34d399;
    --accent-glow: rgba(16, 185, 129, 0.25);
    --accent: #10b981;
    --accent-light: #34d399;
    --accent-secondary: #059669;
}

body.accent-amber {
    --accent-primary: #f59e0b;
    --accent-primary-hover: #fbbf24;
    --accent-glow: rgba(245, 158, 11, 0.25);
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-secondary: #d97706;
}

body.accent-rose {
    --accent-primary: #f43f5e;
    --accent-primary-hover: #fb7185;
    --accent-glow: rgba(244, 63, 94, 0.25);
    --accent: #f43f5e;
    --accent-light: #fb7185;
    --accent-secondary: #e11d48;
}

body.accent-cyan {
    --accent-primary: #06b6d4;
    --accent-primary-hover: #22d3ee;
    --accent-glow: rgba(6, 182, 212, 0.25);
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --accent-secondary: #0891b2;
}

body.accent-violet {
    --accent-primary: #8b5cf6;
    --accent-primary-hover: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.25);
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-secondary: #7c3aed;
}

body.accent-orange {
    --accent-primary: #f97316;
    --accent-primary-hover: #fdba74;
    --accent-glow: rgba(249, 115, 22, 0.25);
    --accent: #f97316;
    --accent-light: #fdba74;
    --accent-secondary: #ea580c;
}

body.accent-black {
    --accent-primary: #000000;
    --accent-primary-hover: #333333;
    --accent-glow: rgba(0, 0, 0, 0.25);
    --accent: #000000;
    --accent-light: #333333;
    --accent-secondary: #1a1a1a;
}

body.theme-slate.accent-black,
body.theme-midnight.accent-black {
    --accent-primary: #ffffff;
    --accent-primary-hover: #e2e8f0;
    --accent-glow: rgba(255, 255, 255, 0.25);
    --accent: #ffffff;
    --accent-light: #e2e8f0;
    --accent-secondary: #cccccc;
}

body.accent-white {
    --accent-primary: #ffffff;
    --accent-primary-hover: #e2e8f0;
    --accent-glow: rgba(255, 255, 255, 0.25);
    --accent: #ffffff;
    --accent-light: #e2e8f0;
    --accent-secondary: #cccccc;
}

body.theme-light.accent-white,
body.theme-paper.accent-white,
body.theme-grayscale.accent-white {
    --accent-primary: #000000;
    --accent-primary-hover: #333333;
    --accent-glow: rgba(0, 0, 0, 0.25);
    --accent: #000000;
    --accent-light: #333333;
    --accent-secondary: #1a1a1a;
}

@media (max-width: 768px) { .theme-switcher-wrapper { top: auto; bottom: 20px; z-index: 99999; } .theme-switcher-btn { border-radius: 8px; width: 40px; height: 40px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); margin-left: 10px; } .theme-switcher-panel { top: auto; bottom: 60px; left: 10px; width: calc(100vw - 20px); transform-origin: bottom left; } }


body.accent-gold { --accent-primary: #d4af37; --accent-primary-hover: #b8962e; --accent-primary-light: rgba(212, 175, 55, 0.1); }


/* Gold UI Button */
.ts-c-gold { background: #d4af37; }
.ts-color-btn.active.ts-c-gold { box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px #d4af37; }
