/* ===== TASKFLOW THEME SYSTEM ===== */

/* ── LIGHT — Trắng tinh ──────────────────────────────────── */
html[data-theme="light"] {
    --bg-base: #f6f8fa;
    --bg-surface: #ffffff;
    --bg-surface2: #eaecef;
    --bg-hover: #d0d7de;
    --border: #c6cdd5;
    --border-light: #e2e6ea;
    --text-primary: #1f2328;
    --text-secondary: #4b5563;
    --text-muted: #7c8794;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --accent-subtle: rgba(9,105,218,0.10);
    --green: #1a7f37;
    --green-light: #1a7f37;
    --green-subtle: rgba(26,127,55,0.10);
    --yellow: #9a6700;
    --yellow-light: #9a6700;
    --yellow-subtle: rgba(154,103,0,0.10);
    --red: #cf222e;
    --red-light: #cf222e;
    --red-subtle: rgba(207,34,46,0.10);
    --purple: #8250df;
    --purple-subtle: rgba(130,80,223,0.10);
    --orange: #bc4c00;
    --orange-light: #bc4c00;
    --orange-subtle: rgba(188,76,0,0.10);
    --shadow: 0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.18);
    --logo-gradient: linear-gradient(135deg,#1f2328 0%,#0969da 100%);
}

/* ── LIGHT WARM — Kem ấm ─────────────────────────────────── */
html[data-theme="light-warm"] {
  --bg-base:     #fdf8f0;
  --bg-surface:  #fffef9;
  --bg-surface2: #fdf3e3;
  --bg-hover:    #f5e6cc;
  --border:      #e8d5b7;
  --border-light:#f5e6cc;
  --text-primary:  #2d1e10;
  --text-secondary:#7a5c3e;
  --text-muted:    #b09070;
  --accent:        #c75d2a;
  --accent-hover:  #a84820;
  --accent-subtle: rgba(199,93,42,0.12);
  --green:        #3d7a3a; --green-light:  #52a34e; --green-subtle: rgba(61,122,58,0.12);
  --yellow:       #a07800; --yellow-light: #c49500; --yellow-subtle:rgba(160,120,0,0.12);
  --red:          #c42b1c; --red-light:    #d93025; --red-subtle:   rgba(196,43,28,0.12);
  --purple:       #7c3aed; --purple-subtle:rgba(124,58,237,0.12);
  --orange:       #b45309; --orange-light: #d97706; --orange-subtle:rgba(180,83,9,0.12);
  --shadow:    0 2px 8px rgba(80,40,0,0.12);
  --shadow-lg: 0 8px 24px rgba(80,40,0,0.18);
  --logo-gradient: linear-gradient(135deg,#2d1e10 0%,#c75d2a 100%);
}

/* ── LIGHT GREEN — Xanh mint ─────────────────────────────── */
html[data-theme="light-green"] {
  --bg-base:     #f0faf4;
  --bg-surface:  #ffffff;
  --bg-surface2: #e8f5ec;
  --bg-hover:    #d4edda;
  --border:      #b3d9bc;
  --border-light:#d4edda;
  --text-primary:  #0f2d1a;
  --text-secondary:#2d6e42;
  --text-muted:    #6aab7e;
  --accent:        #1a7f37;
  --accent-hover:  #116329;
  --accent-subtle: rgba(26,127,55,0.12);
  --green:        #1a7f37; --green-light:  #2da44e; --green-subtle: rgba(26,127,55,0.15);
  --yellow:       #9a6700; --yellow-light: #bf8700; --yellow-subtle:rgba(154,103,0,0.12);
  --red:          #cf222e; --red-light:    #d1242f; --red-subtle:   rgba(207,34,46,0.12);
  --purple:       #8250df; --purple-subtle:rgba(130,80,223,0.12);
  --orange:       #bc4c00; --orange-light: #d4622a; --orange-subtle:rgba(188,76,0,0.12);
  --shadow:    0 2px 8px rgba(0,60,20,0.1);
  --shadow-lg: 0 8px 24px rgba(0,60,20,0.15);
  --logo-gradient: linear-gradient(135deg,#0f2d1a 0%,#1a7f37 100%);
}

/* ── DARK NAVY — Xanh đêm (default) ─────────────────────── */
html[data-theme="dark"], :root {
  --bg-base:     #1a2035;
  --bg-surface:  #232e45;
  --bg-surface2: #2d3a52;
  --bg-hover:    #374660;
  --border:      #445070;
  --border-light:#2d3a52;
  --text-primary:  #e8edf5;
  --text-secondary:#8fa3c0;
  --text-muted:    #556080;
  --accent:        #4d8ef0;
  --accent-hover:  #6ba3f5;
  --accent-subtle: rgba(77,142,240,0.18);
  --green:        #2bb574; --green-light:  #3dd68c; --green-subtle: rgba(43,181,116,0.15);
  --yellow:       #c49a1a; --yellow-light: #e8b929; --yellow-subtle:rgba(196,154,26,0.15);
  --red:          #d94545; --red-light:    #f06565; --red-subtle:   rgba(217,69,69,0.15);
  --purple:       #8b67e8; --purple-subtle:rgba(139,103,232,0.15);
  --orange:       #e07840; --orange-light: #f59058; --orange-subtle:rgba(224,120,64,0.15);
  --shadow:    0 4px 20px rgba(10,15,30,0.4);
  --shadow-lg: 0 8px 40px rgba(10,15,30,0.55);
  --logo-gradient: linear-gradient(135deg,#e8edf5 0%,#6ba3f5 100%);
}

/* ── OCEAN — Xanh biển ───────────────────────────────────── */
html[data-theme="ocean"] {
  --bg-base:     #0d2137;
  --bg-surface:  #162d4a;
  --bg-surface2: #1f3a5c;
  --bg-hover:    #284870;
  --border:      #3a6080;
  --border-light:#1f3a5c;
  --text-primary:  #d4eeff;
  --text-secondary:#7ab8e8;
  --text-muted:    #4a7a9e;
  --accent:        #29b6f6;
  --accent-hover:  #4fc3f7;
  --accent-subtle: rgba(41,182,246,0.18);
  --green:        #26c6a0; --green-light:  #40d9b5; --green-subtle: rgba(38,198,160,0.15);
  --yellow:       #ffb300; --yellow-light: #ffc840; --yellow-subtle:rgba(255,179,0,0.15);
  --red:          #e05555; --red-light:    #f07070; --red-subtle:   rgba(224,85,85,0.15);
  --purple:       #9575cd; --purple-subtle:rgba(149,117,205,0.15);
  --orange:       #ff8a50; --orange-light: #ffa070; --orange-subtle:rgba(255,138,80,0.15);
  --shadow:    0 4px 20px rgba(5,15,30,0.45);
  --shadow-lg: 0 8px 40px rgba(5,15,30,0.6);
  --logo-gradient: linear-gradient(135deg,#d4eeff 0%,#29b6f6 100%);
}

/* ── FOREST — Rừng đêm ───────────────────────────────────── */
html[data-theme="forest"] {
  --bg-base:     #152218;
  --bg-surface:  #1e3024;
  --bg-surface2: #273d2f;
  --bg-hover:    #304a3a;
  --border:      #456650;
  --border-light:#273d2f;
  --text-primary:  #d0eed8;
  --text-secondary:#7dbb8f;
  --text-muted:    #4e7a5c;
  --accent:        #4cba6a;
  --accent-hover:  #6dd486;
  --accent-subtle: rgba(76,186,106,0.18);
  --green:        #2ea44f; --green-light:  #46c068; --green-subtle: rgba(46,164,79,0.18);
  --yellow:       #d4a017; --yellow-light: #f0b830; --yellow-subtle:rgba(212,160,23,0.15);
  --red:          #d04545; --red-light:    #e86060; --red-subtle:   rgba(208,69,69,0.15);
  --purple:       #8a6be0; --purple-subtle:rgba(138,107,224,0.15);
  --orange:       #e07240; --orange-light: #f08858; --orange-subtle:rgba(224,114,64,0.15);
  --shadow:    0 4px 20px rgba(5,15,5,0.4);
  --shadow-lg: 0 8px 40px rgba(5,15,5,0.55);
  --logo-gradient: linear-gradient(135deg,#d0eed8 0%,#4cba6a 100%);
}

/* ── ROSE — Hồng ─────────────────────────────────────────── */
html[data-theme="rose"] {
  --bg-base:     #1e0f1a;
  --bg-surface:  #2d1826;
  --bg-surface2: #3e2236;
  --bg-hover:    #5a3350;
  --border:      #7a4a6a;
  --border-light:#4a2840;
  --text-primary:  #f5d5e8;
  --text-secondary:#d490b8;
  --text-muted:    #9a6080;
  --accent:        #e84d9e;
  --accent-hover:  #f570b5;
  --accent-subtle: rgba(232,77,158,0.18);
  --green:        #2bb585; --green-light:  #3dd8a0; --green-subtle: rgba(43,181,133,0.15);
  --yellow:       #d4a020; --yellow-light: #f0bc38; --yellow-subtle:rgba(212,160,32,0.15);
  --red:          #d44040; --red-light:    #e86060; --red-subtle:   rgba(212,64,64,0.15);
  --purple:       #9b70e0; --purple-subtle:rgba(155,112,224,0.15);
  --orange:       #e07040; --orange-light: #f59060; --orange-subtle:rgba(224,112,64,0.15);
  --shadow:    0 4px 20px rgba(20,5,15,0.45);
  --shadow-lg: 0 8px 40px rgba(20,5,15,0.6);
  --logo-gradient: linear-gradient(135deg,#f5d5e8 0%,#e84d9e 100%);
}

/* ── SLATE — Tím xám ─────────────────────────────────────── */
html[data-theme="slate"] {
  --bg-base:     #1e2030;
  --bg-surface:  #282b40;
  --bg-surface2: #323550;
  --bg-hover:    #3c4060;
  --border:      #505575;
  --border-light:#323550;
  --text-primary:  #e0e4f8;
  --text-secondary:#9aa0d0;
  --text-muted:    #5a6090;
  --accent:        #8888f0;
  --accent-hover:  #a0a0ff;
  --accent-subtle: rgba(136,136,240,0.18);
  --green:        #30b888; --green-light:  #48d4a5; --green-subtle: rgba(48,184,136,0.15);
  --yellow:       #d4aa25; --yellow-light: #f0c840; --yellow-subtle:rgba(212,170,37,0.15);
  --red:          #d04848; --red-light:    #e86868; --red-subtle:   rgba(208,72,72,0.15);
  --purple:       #b080f0; --purple-subtle:rgba(176,128,240,0.15);
  --orange:       #e08850; --orange-light: #f0a070; --orange-subtle:rgba(224,136,80,0.15);
  --shadow:    0 4px 20px rgba(10,10,25,0.4);
  --shadow-lg: 0 8px 40px rgba(10,10,25,0.55);
  --logo-gradient: linear-gradient(135deg,#e0e4f8 0%,#a0a0ff 100%);
}

/* ── AMBER — Hổ phách ────────────────────────────────────── */
html[data-theme="amber"] {
  --bg-base:     #271e08;
  --bg-surface:  #342808;
  --bg-surface2: #40320e;
  --bg-hover:    #4e3e14;
  --border:      #705a20;
  --border-light:#40320e;
  --text-primary:  #fef0c0;
  --text-secondary:#ddb840;
  --text-muted:    #907825;
  --accent:        #f5a623;
  --accent-hover:  #ffc048;
  --accent-subtle: rgba(245,166,35,0.18);
  --green:        #38a860; --green-light:  #50c878; --green-subtle: rgba(56,168,96,0.15);
  --yellow:       #e09a00; --yellow-light: #f5b820; --yellow-subtle:rgba(224,154,0,0.18);
  --red:          #d04040; --red-light:    #e86060; --red-subtle:   rgba(208,64,64,0.15);
  --purple:       #9870e0; --purple-subtle:rgba(152,112,224,0.15);
  --orange:       #e87830; --orange-light: #f09550; --orange-subtle:rgba(232,120,48,0.15);
  --shadow:    0 4px 20px rgba(20,12,0,0.45);
  --shadow-lg: 0 8px 40px rgba(20,12,0,0.6);
  --logo-gradient: linear-gradient(135deg,#fef0c0 0%,#f5a623 100%);
}

/* ── Transition mượt ─────────────────────────────────────── */
*, *::before, *::after {
  transition: background-color 0.25s ease, border-color 0.2s ease, color 0.15s ease !important;
}

/* ── Override cho input, select trong theme sáng ─────────── */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light-warm"] input,
html[data-theme="light-warm"] select,
html[data-theme="light-warm"] textarea,
html[data-theme="light-green"] input,
html[data-theme="light-green"] select,
html[data-theme="light-green"] textarea {
  color-scheme: light;
}

/* ===== THEME PICKER COMPONENT ===== */
.theme-picker-wrap { position: relative; }

.theme-trigger {
    background: var(--bg-surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 34px; height: 34px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: all 0.15s !important;
    flex-shrink: 0;
}
.theme-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: rotate(20deg);
}

.theme-panel {
    position: fixed;
    top: calc(var(--topbar-height, 56px) + 8px);
    right: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl, 16px);
    padding: 16px;
    width: 252px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: themeSlideDown 0.2s ease;
}

@keyframes themeSlideDown {
    from { opacity:0; transform: translateY(-8px); }
    to   { opacity:1; transform: translateY(0); }
}

.theme-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; font-size: 13px; font-weight: 700;
    color: var(--text-primary);
}
.theme-section-label {
    font-size: 10px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 7px;
}
.theme-close {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 20px; line-height: 1;
    padding: 0 4px; border-radius: 4px;
    transition: background 0.15s !important;
}
.theme-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.theme-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.theme-option {
    background: var(--bg-surface2);
    border: 2px solid var(--border);
    border-radius: 8px; padding: 6px;
    cursor: pointer; display: flex; flex-direction: column;
    align-items: center; gap: 5px;
    transition: all 0.15s !important;
    position: relative; font-family: var(--font);
}
.theme-option:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.theme-option.active {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.theme-preview {
    width: 100%; height: 44px; border-radius: 4px; overflow: hidden;
}
.theme-preview-bar { height: 12px; width: 100%; }
.theme-preview-content {
    padding: 4px 5px; display: flex; align-items: center; gap: 4px;
}
.theme-preview-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.theme-preview-line { height: 3px; border-radius: 2px; flex: 1; }
.theme-preview-line.short { flex: 0.5; }
.theme-name {
    font-size: 10px; font-weight: 600; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.theme-option.active .theme-name { color: var(--accent-hover); }
.theme-check {
    position: absolute; top: 3px; right: 3px;
    background: var(--accent); color: #fff;
    font-size: 8px; font-weight: 700;
    width: 14px; height: 14px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.theme-backdrop {
    position: fixed; inset: 0; z-index: 1000; background: transparent;
}
