/* Themes styles. */

/* Theme definitions */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #cccccc;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --gap: 20px;
}

body.light-theme {
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #e0e0e0;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
}

body.dark-theme {
    --bg-primary: #1e1e1e;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #444444;
    --accent-color: #4da3ff;
    --accent-hover: #2d7fd9;
}

body.nord-theme {
    --bg-primary: #2e3440;
    --bg-secondary: #3b4252;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --border-color: #4c566a;
    --accent-color: #81a1c1;
    --accent-hover: #88c0d0;
}

body.dracula-theme {
    --bg-primary: #282a36;
    --bg-secondary: #44475a;
    --text-primary: #f8f8f2;
    --text-secondary: #f1fa8c;
    --border-color: #6272a4;
    --accent-color: #ff79c6;
    --accent-hover: #ffb3d9;
}

body.monokai-theme {
    --bg-primary: #272822;
    --bg-secondary: #3e3d32;
    --text-primary: #f8f8f2;
    --text-secondary: #a6e22e;
    --border-color: #49483e;
    --accent-color: #fd971f;
    --accent-hover: #ff9500;
}

body.solarized-light-theme {
    --bg-primary: #fdf6e3;
    --bg-secondary: #eee8d5;
    --text-primary: #657b83;
    --text-secondary: #586e75;
    --border-color: #d6d0c8;
    --accent-color: #268bd2;
    --accent-hover: #1e6fa0;
}

body.solarized-dark-theme {
    --bg-primary: #002b36;
    --bg-secondary: #073642;
    --text-primary: #93a1a1;
    --text-secondary: #839496;
    --border-color: #586e75;
    --accent-color: #268bd2;
    --accent-hover: #2aa198;
}

body.gruvbox-dark-theme {
    --bg-primary: #282828;
    --bg-secondary: #3c3836;
    --text-primary: #fbf1c7;
    --text-secondary: #d5c4a1;
    --border-color: #504945;
    --accent-color: #d65d0e;
    --accent-hover: #fe8019;
}

body.cyberpunk-theme {
    --bg-primary: #0d0221;
    --bg-secondary: #220a52;
    --text-primary: #ff006e;
    --text-secondary: #fb5607;
    --border-color: #8f2d56;
    --accent-color: #ffbe0b;
    --accent-hover: #ffc300;
}

body.synthwave-theme {
    --bg-primary: #1a0033;
    --bg-secondary: #330066;
    --text-primary: #ff00ff;
    --text-secondary: #00ffff;
    --border-color: #ff0080;
    --accent-color: #00ffff;
    --accent-hover: #ff00ff;
}

body.solarized-alt-dark-theme {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #b0b0b0;
    --text-secondary: #808080;
    --border-color: #404040;
    --accent-color: #6c9ef8;
    --accent-hover: #4a8fe7;
}

body.catppuccin-theme {
    --bg-primary: #1e1e2e;
    --bg-secondary: #313244;
    --text-primary: #cdd6f4;
    --text-secondary: #a6adc8;
    --border-color: #45475a;
    --accent-color: #89b4fa;
    --accent-hover: #a6e3ff;
}

body.one-dark-theme {
    --bg-primary: #282c34;
    --bg-secondary: #3e4451;
    --text-primary: #abb2bf;
    --text-secondary: #828997;
    --border-color: #545862;
    --accent-color: #61afef;
    --accent-hover: #78c1ff;
}

body.github-dark-theme {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    --accent-color: #58a6ff;
    --accent-hover: #79c0ff;
}

body.tokyo-night-theme {
    --bg-primary: #1a1b26;
    --bg-secondary: #292e42;
    --text-primary: #c0caf5;
    --text-secondary: #9aa5ce;
    --border-color: #3b4261;
    --accent-color: #7aa2f7;
    --accent-hover: #9ec8f8;
}

/* Additional themes shared with Prompt Designer */
body.pb-sepia-theme {
    --bg-primary: #f1e7d8;
    --bg-secondary: #faf3e7;
    --text-primary: #3f3324;
    --text-secondary: #84745c;
    --border-color: #d4c3a5;
    --accent-color: #9a6b2f;
    --accent-hover: color-mix(in srgb, #9a6b2f 80%, #000);
}

body.pb-ocean-theme {
    --bg-primary: #0b1e2d;
    --bg-secondary: #10293c;
    --text-primary: #d8e7f2;
    --text-secondary: #7fa0b5;
    --border-color: #1f415c;
    --accent-color: #27b3a3;
    --accent-hover: color-mix(in srgb, #27b3a3 80%, #000);
}

body.pb-rosepine-theme {
    --bg-primary: #faf4ed;
    --bg-secondary: #fffaf3;
    --text-primary: #575279;
    --text-secondary: #9893a5;
    --border-color: #dfd4c4;
    --accent-color: #b4637a;
    --accent-hover: color-mix(in srgb, #b4637a 80%, #000);
}

body.pb-forest-theme {
    --bg-primary: #15201a;
    --bg-secondary: #1b2a22;
    --text-primary: #d6e8dc;
    --text-secondary: #86a392;
    --border-color: #2f4a3b;
    --accent-color: #6fcf97;
    --accent-hover: color-mix(in srgb, #6fcf97 80%, #000);
}

body.pb-contrast-theme {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #c0c0c0;
    --border-color: #6e6e6e;
    --accent-color: #ffd400;
    --accent-hover: color-mix(in srgb, #ffd400 80%, #000);
}

body.pb-mint-theme {
    --bg-primary: #eef7f2;
    --bg-secondary: #ffffff;
    --text-primary: #1d3a2c;
    --text-secondary: #5f8270;
    --border-color: #c5dccf;
    --accent-color: #0e9f6e;
    --accent-hover: color-mix(in srgb, #0e9f6e 80%, #000);
}

body.pb-paper-theme {
    --bg-primary: #f7f5f0;
    --bg-secondary: #fffdf9;
    --text-primary: #2b2620;
    --text-secondary: #7a715f;
    --border-color: #ded7c6;
    --accent-color: #a9702f;
    --accent-hover: color-mix(in srgb, #a9702f 80%, #000);
}

body.pb-linen-theme {
    --bg-primary: #f5f0ea;
    --bg-secondary: #fdfaf6;
    --text-primary: #332a24;
    --text-secondary: #867466;
    --border-color: #ddccbc;
    --accent-color: #c17a6f;
    --accent-hover: color-mix(in srgb, #c17a6f 80%, #000);
}

body.pb-cream-theme {
    --bg-primary: #fdf8ec;
    --bg-secondary: #fffdf5;
    --text-primary: #3a3218;
    --text-secondary: #8b7f52;
    --border-color: #e5d7ab;
    --accent-color: #d4a017;
    --accent-hover: color-mix(in srgb, #d4a017 80%, #000);
}

body.pb-ivory-theme {
    --bg-primary: #fbfaf5;
    --bg-secondary: #ffffff;
    --text-primary: #232722;
    --text-secondary: #6f7a6e;
    --border-color: #dcdacb;
    --accent-color: #2c8c8c;
    --accent-hover: color-mix(in srgb, #2c8c8c 80%, #000);
}

body.pb-blossom-theme {
    --bg-primary: #fdf0f5;
    --bg-secondary: #fffafc;
    --text-primary: #3a1f2c;
    --text-secondary: #8a5f74;
    --border-color: #eecdda;
    --accent-color: #d1477a;
    --accent-hover: color-mix(in srgb, #d1477a 80%, #000);
}

body.pb-lavender-theme {
    --bg-primary: #f3effa;
    --bg-secondary: #fbf9fe;
    --text-primary: #2a2440;
    --text-secondary: #75708f;
    --border-color: #d7c9ea;
    --accent-color: #7c5cbf;
    --accent-hover: color-mix(in srgb, #7c5cbf 80%, #000);
}

body.pb-mist-theme {
    --bg-primary: #eef3f5;
    --bg-secondary: #f9fbfc;
    --text-primary: #1f2d33;
    --text-secondary: #67818c;
    --border-color: #cdd9dd;
    --accent-color: #4f7d94;
    --accent-hover: color-mix(in srgb, #4f7d94 80%, #000);
}

body.pb-sand-theme {
    --bg-primary: #f6ecd9;
    --bg-secondary: #fdf7ea;
    --text-primary: #3a2c14;
    --text-secondary: #8a7550;
    --border-color: #dcc898;
    --accent-color: #c9701f;
    --accent-hover: color-mix(in srgb, #c9701f 80%, #000);
}

body.pb-coral-theme {
    --bg-primary: #fdf1ee;
    --bg-secondary: #fffbfa;
    --text-primary: #3a231d;
    --text-secondary: #8f6157;
    --border-color: #eccbc0;
    --accent-color: #e0604a;
    --accent-hover: color-mix(in srgb, #e0604a 80%, #000);
}

body.pb-sky-theme {
    --bg-primary: #eaf4fb;
    --bg-secondary: #f7fbfe;
    --text-primary: #1a2c38;
    --text-secondary: #5c7f97;
    --border-color: #c3dcec;
    --accent-color: #2a8fd6;
    --accent-hover: color-mix(in srgb, #2a8fd6 80%, #000);
}

body.pb-meadow-theme {
    --bg-primary: #f0f7ec;
    --bg-secondary: #f9fdf6;
    --text-primary: #20301a;
    --text-secondary: #5e7a52;
    --border-color: #c9e0ba;
    --accent-color: #4c9a4c;
    --accent-hover: color-mix(in srgb, #4c9a4c 80%, #000);
}

body.pb-honey-theme {
    --bg-primary: #fdf6e0;
    --bg-secondary: #fffbf0;
    --text-primary: #3a2e0e;
    --text-secondary: #8f7a3e;
    --border-color: #e5d29a;
    --accent-color: #d99a1b;
    --accent-hover: color-mix(in srgb, #d99a1b 80%, #000);
}

body.pb-powder-theme {
    --bg-primary: #eef2fa;
    --bg-secondary: #f8faff;
    --text-primary: #20233c;
    --text-secondary: #616a8f;
    --border-color: #c9d1ec;
    --accent-color: #6a7fd6;
    --accent-hover: color-mix(in srgb, #6a7fd6 80%, #000);
}

body.pb-birch-theme {
    --bg-primary: #f6f4ee;
    --bg-secondary: #fdfcf8;
    --text-primary: #2c2820;
    --text-secondary: #7d745f;
    --border-color: #dcd6c1;
    --accent-color: #8a7256;
    --accent-hover: color-mix(in srgb, #8a7256 80%, #000);
}

body.pb-dawn-theme {
    --bg-primary: #fdeeee;
    --bg-secondary: #fff8f8;
    --text-primary: #3a1e1c;
    --text-secondary: #8f5e5a;
    --border-color: #ecc7c5;
    --accent-color: #d1594f;
    --accent-hover: color-mix(in srgb, #d1594f 80%, #000);
}

body.pb-abyss-theme {
    --bg-primary: #0a0e14;
    --bg-secondary: #101620;
    --text-primary: #d6e6ec;
    --text-secondary: #7793a0;
    --border-color: #1e2a38;
    --accent-color: #2fb8c6;
    --accent-hover: color-mix(in srgb, #2fb8c6 80%, #000);
}

body.pb-obsidian-theme {
    --bg-primary: #12141a;
    --bg-secondary: #181b23;
    --text-primary: #e2ddf0;
    --text-secondary: #8d87a8;
    --border-color: #2c2f3d;
    --accent-color: #9b6bd6;
    --accent-hover: color-mix(in srgb, #9b6bd6 80%, #000);
}

body.pb-charcoal-theme {
    --bg-primary: #1c1c1e;
    --bg-secondary: #242426;
    --text-primary: #eceaea;
    --text-secondary: #9a9a9d;
    --border-color: #3a3a3d;
    --accent-color: #e08a3c;
    --accent-hover: color-mix(in srgb, #e08a3c 80%, #000);
}

body.pb-midnight-theme {
    --bg-primary: #0d1024;
    --bg-secondary: #13172f;
    --text-primary: #dbe0f5;
    --text-secondary: #7f87ba;
    --border-color: #232853;
    --accent-color: #4d7ff0;
    --accent-hover: color-mix(in srgb, #4d7ff0 80%, #000);
}

body.pb-plum-theme {
    --bg-primary: #211320;
    --bg-secondary: #2b1a2a;
    --text-primary: #efe0ee;
    --text-secondary: #a5859f;
    --border-color: #402f42;
    --accent-color: #d162c4;
    --accent-hover: color-mix(in srgb, #d162c4 80%, #000);
}

body.pb-slate-theme {
    --bg-primary: #1a2027;
    --bg-secondary: #212932;
    --text-primary: #d8e2e8;
    --text-secondary: #7f929e;
    --border-color: #354049;
    --accent-color: #48b0a0;
    --accent-hover: color-mix(in srgb, #48b0a0 80%, #000);
}

body.pb-ember-theme {
    --bg-primary: #1e1512;
    --bg-secondary: #271b17;
    --text-primary: #f0e2da;
    --text-secondary: #a68b7d;
    --border-color: #3c2c25;
    --accent-color: #e0602f;
    --accent-hover: color-mix(in srgb, #e0602f 80%, #000);
}

body.pb-neon-theme {
    --bg-primary: #0e0e14;
    --bg-secondary: #15151d;
    --text-primary: #e8f0d8;
    --text-secondary: #8b9880;
    --border-color: #2a2c38;
    --accent-color: #b8f24c;
    --accent-hover: color-mix(in srgb, #b8f24c 80%, #000);
}

body.pb-cyber-theme {
    --bg-primary: #0a1420;
    --bg-secondary: #0f1c2c;
    --text-primary: #d4f5f2;
    --text-secondary: #6f9aa0;
    --border-color: #1a3040;
    --accent-color: #29e0d6;
    --accent-hover: color-mix(in srgb, #29e0d6 80%, #000);
}

body.pb-amethyst-theme {
    --bg-primary: #1a1226;
    --bg-secondary: #221a30;
    --text-primary: #ece0f5;
    --text-secondary: #9c85b5;
    --border-color: #332a48;
    --accent-color: #a566e0;
    --accent-hover: color-mix(in srgb, #a566e0 80%, #000);
}

body.pb-graphite-theme {
    --bg-primary: #191a1c;
    --bg-secondary: #212226;
    --text-primary: #dfe3e6;
    --text-secondary: #8b9299;
    --border-color: #37393e;
    --accent-color: #7fa0b8;
    --accent-hover: color-mix(in srgb, #7fa0b8 80%, #000);
}

body.pb-indigo-theme {
    --bg-primary: #10122a;
    --bg-secondary: #161933;
    --text-primary: #dedff5;
    --text-secondary: #8386ba;
    --border-color: #282c5a;
    --accent-color: #6a6ff0;
    --accent-hover: color-mix(in srgb, #6a6ff0 80%, #000);
}

body.pb-crimson-theme {
    --bg-primary: #200b0e;
    --bg-secondary: #2a1114;
    --text-primary: #f2dee0;
    --text-secondary: #b0838a;
    --border-color: #3f1f23;
    --accent-color: #e0435f;
    --accent-hover: color-mix(in srgb, #e0435f 80%, #000);
}

body.pb-steel-theme {
    --bg-primary: #16191d;
    --bg-secondary: #1d2126;
    --text-primary: #d6e0e6;
    --text-secondary: #7c8d98;
    --border-color: #2e3540;
    --accent-color: #5a8ab0;
    --accent-hover: color-mix(in srgb, #5a8ab0 80%, #000);
}

body.pb-void-theme {
    --bg-primary: #050507;
    --bg-secondary: #0c0c10;
    --text-primary: #e8e5f5;
    --text-secondary: #8a86a5;
    --border-color: #1e1e26;
    --accent-color: #8f7fe0;
    --accent-hover: color-mix(in srgb, #8f7fe0 80%, #000);
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme-safe content surfaces. These replace the light-mode literals
   above and are populated after every theme change. */
body, #sidebar, #content, #controlPanel, #dropZone,
#folderPickerBtn, .tree-item, .tab.active, .toolbar-icon-btn,
#reloadBtn, #voicePanel {
    color: var(--a11y-text, var(--text-primary));
}

.placeholder, .sidebar-placeholder-text, .tab,
.tab .tab-close, #voicePanel .voice-value,
#content h6, #content blockquote,
.form-item input[type="checkbox"]:checked + label {
    color: var(--a11y-muted, var(--text-secondary));
}

#content a {
    color: var(--a11y-text, var(--text-primary));
    text-decoration: underline;
    text-decoration-color: var(--accent-color);
    text-decoration-thickness: 2px;
}

#content details summary:hover {
    color: var(--a11y-text, var(--text-primary));
    text-decoration: underline;
    text-decoration-color: var(--accent-color);
}

.tree-item.file.open {
    color: var(--a11y-text, var(--text-primary));
    box-shadow: inset 3px 0 0 var(--accent-color);
}

#content code, #content pre {
    background: var(--a11y-code-bg, var(--bg-primary));
    color: var(--a11y-code-text, var(--text-primary));
}

#content pre code {
    color: inherit;
}

#content pre.mermaid-error {
    color: var(--a11y-text, var(--text-primary));
}

#content th, #content td {
    color: var(--a11y-text, var(--text-primary));
    border-color: var(--border-color);
}

#content th {
    background: var(--a11y-table-bg, var(--bg-primary));
}

#content input[type="text"],
#content input[type="number"],
#content input[type="date"],
#content input[type="datetime-local"],
#content input[type="time"],
#content input[type="color"],
#content textarea,
#content select {
    background: var(--a11y-input-bg, var(--bg-primary));
    color: var(--a11y-input-text, var(--text-primary));
    border-color: var(--border-color);
}

#sidebarToggle, #saveBtn {
    color: var(--a11y-on-accent, #ffffff);
}

.status-message.success {
    color: #000000;
}

#dropZone {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
    margin: var(--gap);
    border-radius: var(--gap);
}

#content {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#controlPanel {
    background: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#saveBtn {
    background: var(--accent-color);
}

#saveBtn:hover {
    background: var(--accent-hover);
}
