/**
 * Color Theme Variables
 * Defines color schemes for the application
 */

/* Default Dark Theme */
:root,
[data-theme="dark"] {
    /* Background colors */
    --bg-primary: #141414;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2a2a2a;
    --bg-hover: #333333;
    --bg-nav: #0a0a0a;

    /* Text colors */
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #6b6b6b;

    /* Border colors */
    --border-color: #333333;
    --border-focus: #10a37f;

    /* Accent colors */
    --accent-color: #10a37f;
    --accent-hover: #0d8c6c;
    --success-color: #10a37f;
    --warning-color: #f59e0b;
    --error-color: #ef4444;

    /* Model badge color */
    --model-badge-bg: #10a37f;

    /* User message colors */
    --user-msg-bg: #2a2a2a;
    --user-message-border: #404040;

    /* Selection colors */
    --selection-bg: rgba(16, 163, 127, 0.3);
    --selection-text: #e0e0e0;

    /* Shadow */
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);

    /* Link colors */
    --link-color: #7ab8ff;
    --link-hover: #6aa0e0;
    --link-visited: #c58aff;
    --link-visited-hover: #b07ae0;

    /* Highlight colors */
    --blockquote-bg: rgba(16, 163, 127, 0.1);

    /* Star colors */
    --star-color: #fbbf24;

    /* Search highlight */
    --search-highlight-bg: #ffeb3b;
    --search-highlight-text: #000;
    --search-highlight-active-bg: #ff9800;
    --search-highlight-active-text: #fff;

    /* Duplicate badge colors */
    --duplicate-old-bg: rgba(255, 107, 107, 0.13);
    --duplicate-old-text: #ff6b6b;
    --duplicate-new-bg: rgba(81, 207, 102, 0.13);
    --duplicate-new-text: #51cf66;

    /* Additional theme-specific variables */
    --input-bg: #2f2f2f;
    --assistant-msg-bg: transparent;
    --danger: #ef4444;
    --success: #22c55e;
    --scrollbar-hover: #555;
}

/* Bright Theme */
[data-theme="bright"] {
    /* Background colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    --bg-nav: #f1f5f9;

    /* Text colors */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Border colors */
    --border-color: #cbd5e1;
    --border-focus: #8b5cf6;

    /* Accent colors */
    --accent-color: #8b5cf6;
    --accent-hover: #7c3aed;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;

    /* Model badge color */
    --model-badge-bg: #8b5cf6;

    /* User message colors */
    --user-msg-bg: #e2e8f0;
    --user-message-border: #cbd5e1;

    /* Selection colors */
    --selection-bg: rgba(139, 92, 246, 0.2);
    --selection-text: #1e293b;

    /* Shadow */
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);

    /* Link colors */
    --link-color: #0066cc;
    --link-hover: #0052a3;
    --link-visited: #9333ea;
    --link-visited-hover: #7e22ce;

    /* Highlight colors */
    --blockquote-bg: rgba(139, 92, 246, 0.08);

    /* Star colors */
    --star-color: #f59e0b;

    /* Search highlight */
    --search-highlight-bg: #fef08a;
    --search-highlight-text: #1e293b;
    --search-highlight-active-bg: #f59e0b;
    --search-highlight-active-text: #fff;

    /* Duplicate badge colors */
    --duplicate-old-bg: rgba(239, 68, 68, 0.1);
    --duplicate-old-text: #dc2626;
    --duplicate-new-bg: rgba(34, 197, 94, 0.1);
    --duplicate-new-text: #16a34a;

    /* Additional theme-specific variables */
    --input-bg: #e2e8f0;
    --assistant-msg-bg: transparent;
    --danger: #ef4444;
    --success: #22c55e;
    --scrollbar-hover: #94a3b8;
}

/* Professional Theme (Sophisticated Dark Slate) */
[data-theme="professional"] {
    /* Background colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    --bg-nav: #0c1222;

    /* Text colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Border colors */
    --border-color: #334155;
    --border-focus: #3b82f6;

    /* Accent colors */
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;

    /* Model badge color */
    --model-badge-bg: #3b82f6;

    /* User message colors */
    --user-msg-bg: #334155;
    --user-message-border: #475569;

    /* Selection colors */
    --selection-bg: rgba(59, 130, 246, 0.3);
    --selection-text: #f1f5f9;

    /* Shadow */
    --shadow: rgba(0, 0, 0, 0.4);
    --shadow-lg: rgba(0, 0, 0, 0.6);

    /* Link colors */
    --link-color: #60a5fa;
    --link-hover: #3b82f6;
    --link-visited: #a78bfa;
    --link-visited-hover: #8b5cf6;

    /* Highlight colors */
    --blockquote-bg: rgba(59, 130, 246, 0.1);

    /* Star colors */
    --star-color: #fbbf24;

    /* Search highlight */
    --search-highlight-bg: #fef08a;
    --search-highlight-text: #0f172a;
    --search-highlight-active-bg: #f59e0b;
    --search-highlight-active-text: #fff;

    /* Duplicate badge colors */
    --duplicate-old-bg: rgba(239, 68, 68, 0.2);
    --duplicate-old-text: #f87171;
    --duplicate-new-bg: rgba(34, 197, 94, 0.2);
    --duplicate-new-text: #4ade80;

    /* Additional theme-specific variables */
    --input-bg: #1e293b;
    --assistant-msg-bg: transparent;
    --danger: #ef4444;
    --success: #10b981;
    --scrollbar-hover: #64748b;
}

/* Cool Theme (Deep Ocean Blue) */
[data-theme="cool"] {
    /* Background colors */
    --bg-primary: #001529;
    --bg-secondary: #002140;
    --bg-tertiary: #003055;
    --bg-hover: #004080;
    --bg-nav: #000f1f;

    /* Text colors */
    --text-primary: #e6f7ff;
    --text-secondary: #91d5ff;
    --text-muted: #69c0ff;

    /* Border colors */
    --border-color: #003055;
    --border-focus: #1890ff;

    /* Accent colors */
    --accent-color: #1890ff;
    --accent-hover: #096dd9;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #f5222d;

    /* Model badge color */
    --model-badge-bg: #1890ff;

    /* User message colors */
    --user-msg-bg: #003055;
    --user-message-border: #004080;

    /* Selection colors */
    --selection-bg: rgba(24, 144, 255, 0.3);
    --selection-text: #e6f7ff;

    /* Shadow */
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-lg: rgba(0, 0, 0, 0.7);

    /* Link colors */
    --link-color: #40a9ff;
    --link-hover: #1890ff;
    --link-visited: #b37feb;
    --link-visited-hover: #9254de;

    /* Highlight colors */
    --blockquote-bg: rgba(24, 144, 255, 0.1);

    /* Star colors */
    --star-color: #faad14;

    /* Search highlight */
    --search-highlight-bg: #fffb8f;
    --search-highlight-text: #001529;
    --search-highlight-active-bg: #faad14;
    --search-highlight-active-text: #fff;

    /* Duplicate badge colors */
    --duplicate-old-bg: rgba(245, 34, 45, 0.2);
    --duplicate-old-text: #ff4d4f;
    --duplicate-new-bg: rgba(82, 196, 26, 0.2);
    --duplicate-new-text: #73d13d;

    /* Additional theme-specific variables */
    --input-bg: #003055;
    --assistant-msg-bg: transparent;
    --danger: #f5222d;
    --success: #52c41a;
    --scrollbar-hover: #0050b3;
}

/* Cute Theme */
[data-theme="cute"] {
    /* Background colors */
    --bg-primary: #fdf2f8;
    --bg-secondary: #fce7f3;
    --bg-tertiary: #fbcfe8;
    --bg-hover: #f9a8d4;
    --bg-nav: #fdf2f8;

    /* Text colors */
    --text-primary: #831843;
    --text-secondary: #9d174d;
    --text-muted: #be185d;

    /* Border colors */
    --border-color: #f9a8d4;
    --border-focus: #ec4899;

    /* Accent colors */
    --accent-color: #ec4899;
    --accent-hover: #db2777;
    --success-color: #f472b6;
    --warning-color: #fb923c;
    --error-color: #f43f5e;

    /* Model badge color */
    --model-badge-bg: #ec4899;

    /* User message colors */
    --user-msg-bg: #fbcfe8;
    --user-message-border: #f9a8d4;

    /* Selection colors */
    --selection-bg: rgba(236, 72, 153, 0.2);
    --selection-text: #831843;

    /* Shadow */
    --shadow: rgba(236, 72, 153, 0.15);
    --shadow-lg: rgba(236, 72, 153, 0.25);

    /* Link colors */
    --link-color: #ec4899;
    --link-hover: #db2777;
    --link-visited: #8b5cf6;
    --link-visited-hover: #7c3aed;

    /* Highlight colors */
    --blockquote-bg: rgba(236, 72, 153, 0.1);

    /* Star colors */
    --star-color: #fbbf24;

    /* Search highlight */
    --search-highlight-bg: #fef08a;
    --search-highlight-text: #831843;
    --search-highlight-active-bg: #f59e0b;
    --search-highlight-active-text: #fff;

    /* Duplicate badge colors */
    --duplicate-old-bg: rgba(244, 63, 94, 0.15);
    --duplicate-old-text: #f43f5e;
    --duplicate-new-bg: rgba(52, 211, 153, 0.15);
    --duplicate-new-text: #10b981;

    /* Additional theme-specific variables */
    --input-bg: #fbcfe8;
    --assistant-msg-bg: transparent;
    --danger: #f43f5e;
    --success: #f472b6;
    --scrollbar-hover: #f9a8d4;
}

/* Apply selection styles globally */
::selection {
    background-color: var(--selection-bg);
    color: var(--selection-text);
}

::-moz-selection {
    background-color: var(--selection-bg);
    color: var(--selection-text);
}

/* Smooth transition for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Skip transitions for specific elements if needed */
.no-transition {
    transition: none !important;
}

/* Theme Options UI */
.theme-options {
    margin-top: 12px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-option:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.theme-option.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.theme-preview {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.theme-color {
    flex: 1;
    height: 100%;
}

.theme-color.primary {
    flex: 2;
}

.theme-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Responsive theme grid */
@media (max-width: 768px) {
    .theme-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 12px;
    }

    .theme-option {
        padding: 12px;
    }

    .theme-preview {
        width: 50px;
        height: 35px;
    }

    .theme-name {
        font-size: 12px;
    }
}
