:root {
    --bg-color: #1e1e2e;
    --card-bg: #2b2b3f;
    --text-color: #cdd6f4;
    --accent-color: #89b4fa; /* Default Blue */
    --button-hover: #b4befe;
    --input-bg: #181825;
    --hover-bg: #313244;
}

/* Light Theme Override */
[data-theme="light"] {
    --bg-color: #eff1f5;
    --card-bg: #e6e9ef;
    --text-color: #4c4f69;
    --accent-color: #1e66f5; /* Blue */
    --button-hover: #7287fd;
    --input-bg: #dce0e8;
    --hover-bg: #ccd0da;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding-top: 80px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 95%;
    max-width: 800px;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin: 0 auto;
    box-sizing: border-box;
    flex: 1;
}

h1 {
    margin-top: 0;
    color: var(--accent-color);
    text-align: center;
}

/* Status Bar */
.status-bar {
    font-size: 0.9rem;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 6px;
    background-color: var(--input-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ff5555;
    margin-right: 8px;
}

.status-indicator.online {
    background-color: #a6e3a1;
}

/* Inputs & Forms */
.input-group { margin-bottom: 20px; }

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

textarea, input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid #45475a;
    color: var(--text-color);
    padding: 12px;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: inherit;
    margin-bottom: 20px;
    resize: vertical;
}

/* Code Blocks & Typography */
pre {
    background-color: #11111b;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid #45475a;
    margin: 10px 0;
}

code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #f38ba8; /* Red/Pinkish for code */
}

[data-theme="light"] pre { background-color: #dce0e8; border-color: #bcc0cc; }
[data-theme="light"] code { color: #d20f39; }
[data-theme="light"] .thinking-box { background-color: #dce0e8; border-color: #bcc0cc; color: #4c4f69; }

/* Buttons */
button {
    background-color: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    font-size: 1rem;
}

button:hover {
    background-color: var(--button-hover);
}

button:disabled {
    background-color: #45475a;
    cursor: not-allowed;
}

/* Utility Classes */
.output-area {
    margin-top: 30px;
    border-top: 1px solid #45475a;
    padding-top: 20px;
}

.copy-btn, .save-btn, .speak-btn {
    background-color: #45475a;
    color: white;
    width: auto;
    font-size: 0.8rem;
    padding: 5px 10px;
    margin-bottom: 5px;
    float: right;
    cursor: pointer;
    border: none;
    border-radius: 4px;
}

.copy-btn:hover, .save-btn:hover, .speak-btn:hover {
    background-color: #585b70;
}

.stop-btn {
    background-color: #ff5555;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    display: none;
}
.stop-btn:hover { background-color: #ff6e6e; }

.back-link { display: block; text-align: center; margin-top: 20px; color: var(--accent-color); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.row { display: flex; gap: 20px; }
.col { flex: 1; }

/* Loader */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: none;
    margin: 0 auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Thinking Box */
.thinking-box {
    background-color: #11111b;
    border: 1px solid #45475a;
    border-left: 4px solid var(--accent-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    color: #a6adc8;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.thinking-header {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    user-select: none;
}
.thinking-header::before {
    content: '▼';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.8em;
    transition: transform 0.2s;
}
.thinking-header.collapsed::before {
    transform: rotate(-90deg);
}

/* Info Box / Tool Tip */
.info-box {
    background-color: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    border-left: 4px solid var(--accent-color);
    line-height: 1.4;
}

/* --- Layout Components (Navbar & Footer) --- */

/* Navbar */
.navbar {
    position: fixed; top: 0; left: 0; width: 100%; height: 60px;
    background-color: var(--card-bg);
    border-bottom: 1px solid #45475a;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; box-sizing: border-box; z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}
.nav-brand { font-size: 1.2rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.nav-brand a { color: var(--accent-color); text-decoration: none; }
.nav-links { list-style: none; display: flex; gap: 25px; margin: 0; padding: 0; align-items: center; }
.nav-links a { color: var(--text-color); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-color); }

/* Hamburger Menu */
.hamburger { display: none; font-size: 1.5rem; background: none; border: none; color: var(--text-color); cursor: pointer; padding: 0; width: auto; }
.hamburger:hover { background: none; color: var(--accent-color); }

@media (max-width: 768px) {
    .hamburger { display: block; }
    .nav-links { 
        display: none; 
        position: absolute; 
        top: 60px; 
        left: 0; 
        width: 100%; 
        flex-direction: column; 
        background-color: var(--card-bg); 
        border-bottom: 1px solid #45475a; 
        padding: 0; 
        gap: 0; 
    }
    .nav-links.active { display: flex; }
    .nav-links li { width: 100%; text-align: left; }
    .nav-links a { display: block; padding: 15px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); width: 100%; box-sizing: border-box; }
    
    /* Mobile Dropdown */
    .dropdown-content { position: static; box-shadow: none; border: none; background-color: rgba(0,0,0,0.2); width: 100%; }
    .dropdown:hover .dropdown-content { display: none; } /* Disable CSS hover */
    .dropdown.active .dropdown-content { display: block; } /* Enable JS toggle */
    .dropbtn { width: 100%; text-align: left; }
}

/* Dropdown */
.dropdown { position: relative; }
.dropdown-content {
    display: none; position: absolute; top: 100%; right: 0;
    background-color: var(--card-bg);
    min-width: 220px; max-height: 60vh; overflow-y: auto;
    border: 1px solid #45475a; border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4); padding: 5px 0;
}
/* Desktop Hover */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-content { display: block; }
}
.dropdown-content a { display: block; padding: 10px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.dropdown-content a:last-child { border-bottom: none; }
.dropdown-content a:hover { background-color: rgba(255,255,255,0.05); padding-left: 25px; }

/* Footer */
.footer {
    margin-top: 60px; padding: 20px; text-align: center;
    border-top: 1px solid #45475a; color: #6c7086; font-size: 0.8rem;
    background-color: rgba(0,0,0,0.2);
}
.footer a { color: #6c7086; text-decoration: none; border-bottom: 1px dotted #6c7086; }
.footer a:hover { color: var(--accent-color); border-bottom-style: solid; }