/* ==========================================
   AGRICULTURAL BIOTECH TERMINAL THEME
========================================== */
:root {
    --bg-main: #0a1a12;          /* Deep dark forest green-black */
    --bg-sidebar: #0d1f15;       /* Sidebar dark bio-green */
    --bg-input: #0f2318;         /* Input field dark green */
    --bg-hover: #163324;         /* Hover state muted green */
    --text-primary: #d4efdf;     /* Soft mint white */
    --text-secondary: #5a7d6a;   /* Muted sage labels */
    --accent-blue: #2ecc71;      /* Primary Emerald Green */
    --accent-pink: #00ff88;      /* Secondary Neon Bio-Fluorescent */
    --sidebar-width: 280px;
    --transition-speed: 0.2s;
    --cyber-glow-cyan: inset 0 0 10px rgba(46, 204, 113, 0.2);
    --cyber-glow-pink: inset 0 0 10px rgba(0, 255, 136, 0.15);

    /* --- 1. DEFAULT MOUSE POINTER --- */
    --cursor-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M2 2l11 8.5-4.5 1.5 3.5 5.5-2 1.25-3.5-5.5-2.5 3V2z' fill='%230a1a12' stroke='%232ecc71' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 2 2, auto;

    /* --- 2. HOVER INTERACTIVE MOUSE --- */
    --cursor-pointer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Ccircle cx='7' cy='7' r='3' fill='%232ecc71' stroke='%230a1a12' stroke-width='1.2'/%3E%3C/svg%3E") 7 7, pointer;

    /* --- 3. TEXT CARET --- */
    --cursor-text: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12' fill='none'%3E%3Cpath d='M4 1v10M1 1h6M1 11h6' stroke='%232ecc71' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 4 6, text;
}

/* ==========================================
   RESET & STRUCTURAL PANEL GRID SYSTEM
========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    cursor: var(--cursor-default);
    -webkit-font-smoothing: antialiased;
}

@keyframes cyberCoreGradient {
    0% { background-position: 0 0, 0 0, 0% 50%; }
    50% { background-position: 0 0, 0 0, 100% 50%; }
    100% { background-position: 0 0, 0 0, 0% 50%; }
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    overflow-x: hidden;
    width: 100%;
    position: relative;

    /* Animated Digital Core & Grid Overlay */
    background: 
        linear-gradient(rgba(46, 204, 113, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(46, 204, 113, 0.05) 1px, transparent 1px),
        linear-gradient(-45deg, #050a08, #0a1f26, #0a2e19, #040a08);
    background-size: 30px 30px, 30px 30px, 400% 400%;
    animation: cyberCoreGradient 18s ease infinite;
}

/* Precise pointer attachments to prevent massive layout scaling */
a, button, .action-btn, .history-item, .user-profile, .menu-btn {
    cursor: var(--cursor-pointer) !important;
}

/* Locks down the clean micro-beam tightly inside text boxes */
textarea, input, .chat-input {
    cursor: var(--cursor-text) !important;
}

/* ==========================================
   SIDEBAR FRAME
========================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: rgba(10, 15, 10, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 16px;
    border-right: 1px solid var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.15);
    transition: width var(--transition-speed) cubic-bezier(0.2, 1, 0.2, 1), padding var(--transition-speed) ease;
    z-index: 10;
}

.sidebar.collapsed {
    width: 0;
    padding: 22px 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 4px;
    transition: all 0.2s;
}

.menu-btn:hover {
    color: var(--accent-blue);
    background-color: rgba(46, 204, 113, 0.06);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: transparent;
    border: 1px solid rgba(46, 204, 113, 0.2);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
    transition: all 0.2s cubic-bezier(0.2, 1, 0.2, 1);
}

.new-chat-btn:hover {
    background-color: rgba(46, 204, 113, 0.06);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

/* History Streams */
.chat-history {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    max-height: 55vh;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    border-left: 2px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.15s ease;
}

.history-item:hover {
    background-color: var(--bg-hover);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    padding-left: 16px;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid rgba(46, 204, 113, 0.05);
    padding-top: 18px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
}

.nav-link:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* ==========================================
   MAIN INTERFACE
========================================== */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    min-width: 0;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background-color: rgba(10, 15, 10, 0.75);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--accent-blue);
    box-shadow: 0 2px 15px rgba(0, 255, 136, 0.15);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: HUDpulse 4s infinite ease-in-out;
}

.user-profile {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid rgba(46, 204, 113, 0.15);
    background-color: rgba(46, 204, 113, 0.04);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.user-profile:hover {
    border-color: var(--accent-pink);
    color: var(--accent-pink);
}

/* ==========================================
   DIALOGUE DISPLAY
========================================== */
.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    scroll-behavior: smooth;
    box-shadow: inset 0 0 10px rgba(46, 204, 113, 0.2);
}

/* Welcome Screen Banner */
.welcome-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    height: 50%;
    gap: 8px;
    border-left: 2px solid var(--accent-blue);
    padding-left: 24px;
}

.welcome-screen h1 {
    font-size: clamp(24px, 3.5vw, 28px);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.welcome-screen h2 {
    font-size: clamp(14px, 2vw, 16px);
    color: var(--accent-blue);
    font-weight: 400;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

/* Message Blocks */
.message-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 16px;
    background-color: rgba(10, 15, 10, 0.75);
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    position: relative;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.15);
    backdrop-filter: blur(5px);
    animation: HUDframeLoad 0.25s cubic-bezier(0.1, 1, 0.1, 1) forwards;
}

/* Thin bio-green side-accents */
.message-row:has(.user-avatar) {
    border-right: 2px solid var(--accent-pink);
}
.message-row:has(.bot-avatar) {
    border-left: 2px solid var(--accent-blue);
}

@keyframes HUDframeLoad {
    from { opacity: 0; transform: scale(0.99) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar {
    background-color: rgba(0, 255, 136, 0.06);
    border: 1px solid rgba(0, 255, 136, 0.15);
    color: var(--accent-pink);
}

.bot-avatar {
    background-color: rgba(46, 204, 113, 0.06);
    border: 1px solid rgba(46, 204, 113, 0.15);
    color: var(--accent-blue);
}

.message-content {
    flex: 1;
    line-height: 1.65;
    font-size: 14.5px;
    color: var(--text-primary);
    word-break: break-word;
    height: auto;
    min-height: 24px;
    overflow-y: auto;
}

/* ==========================================
   INPUT INTERFACE
========================================== */
.input-wrapper {
    padding: 16px 24px 36px 24px;
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
}

.input-container {
    background-color: rgba(10, 15, 10, 0.75);
    border: 1px solid var(--accent-blue);
    border-radius: 6px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.15);
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.input-container:focus-within {
    border-color: var(--accent-blue);
    box-shadow: inset 0 0 10px rgba(46, 204, 113, 0.2);
    background-color: #112b1d;
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14.5px;
    resize: none;
    max-height: 160px;
    height: 22px;
    line-height: 22px;
}

.chat-input::placeholder {
    color: rgba(212, 239, 223, 0.2);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.action-btn:hover {
    color: var(--accent-blue);
    background-color: rgba(46, 204, 113, 0.06);
}

#sendBtn {
    color: var(--accent-blue);
    border: 1px solid rgba(46, 204, 113, 0.2);
    background-color: rgba(46, 204, 113, 0.04);
}

#sendBtn:hover {
    background-color: rgba(46, 204, 113, 0.1);
    border-color: var(--accent-blue);
}

.footer-note {
    text-align: center;
    font-size: 11px;
    color: rgba(212, 239, 223, 0.15);
    margin-top: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================
   ANIMATIONS & SCROLL BAR
========================================== */
@keyframes HUDpulse {
    0%, 100% { opacity: 0.95; filter: drop-shadow(0 0 2px rgba(46, 204, 113, 0.1)); }
    50% { opacity: 1; filter: drop-shadow(0 0 6px rgba(46, 204, 113, 0.25)); }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(46, 204, 113, 0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

@media (max-width: 768px) {
    .sidebar { position: absolute; height: 100%; left: 0; top: 0; box-shadow: 20px 0 40px rgba(0,0,0,0.7); border-right: 1px solid rgba(46, 204, 113, 0.1); }
    .sidebar.collapsed { left: calc(var(--sidebar-width) * -1); }
    .input-wrapper { padding: 10px 16px 24px 16px; }
    .chat-window { padding: 16px 12px; }
    .hide-on-mobile { display: none !important; }
    .preset-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .preset-btn {
        width: 100%;
        padding: 12px;
    }
}

/* ==========================================
   PRESET CALCULATOR ACTIONS
========================================== */
.preset-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}
.preset-btn {
    background-color: rgba(46, 204, 113, 0.05);
    border: 1px solid rgba(46, 204, 113, 0.2);
    color: var(--accent-blue);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s cubic-bezier(0.1, 1, 0.1, 1);
}
.preset-btn:hover {
    background-color: rgba(46, 204, 113, 0.15);
    color: var(--text-primary);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 255, 136, 0.1);
    border-color: var(--accent-pink);
}

/* HUD Toggle Button */
.hud-toggle {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 4px 10px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 4px;
    cursor: var(--cursor-pointer) !important;
    text-transform: uppercase;
    transition: all 0.2s;
    margin-right: 12px;
}
.hud-toggle:hover {
    background: rgba(46, 204, 113, 0.08);
}
.hud-toggle.audio-off {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
    box-shadow: none;
    background: transparent;
}

.message-content {
    white-space: pre-wrap;
}

/* ==========================================
   NEW ANIMATIONS & SCANLINES
========================================== */
.scanlines {
    position: relative;
}
.scanlines::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.1)
    );
    background-size: 100% 4px;
    z-index: 50;
    pointer-events: none;
    opacity: 0.6;
    animation: scanlineScroll 10s linear infinite;
}

@keyframes scanlineScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100vh; }
}

@keyframes slideUpFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUpFadeIn 0.4s cubic-bezier(0.1, 1, 0.1, 1) forwards;
}

/* Data Pulse effect class for numeric highlights */
.pulse-data {
    color: var(--accent-pink);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
    transition: color 0.2s, text-shadow 0.2s;
}

/* ==========================================
   MODAL & SETTINGS
========================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 26, 18, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--accent-blue);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.2);
    width: 90%;
    max-width: 400px;
    padding: 24px;
    border-radius: 8px;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-header {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent-blue);
    border-bottom: 1px solid rgba(46, 204, 113, 0.2);
    padding-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.modal-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-group label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.modal-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 4px;
    font-family: inherit;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.modal-btn {
    background: rgba(46, 204, 113, 0.1);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.2s;
    align-self: flex-end;
}

.modal-btn:hover {
    background: rgba(46, 204, 113, 0.3);
}

/* ==========================================
   SIDEBAR HISTORY ACTIONS
========================================== */
.history-item-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 2px solid transparent;
    padding-right: 8px;
}

.history-item-container:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.history-item-container .history-item {
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-left: none; /* remove original border */
}

.history-actions {
    display: flex;
    gap: 4px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.history-item-container:hover .history-actions {
    opacity: 1;
}

.history-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.history-icon:hover {
    color: var(--accent-pink);
}

/* ==========================================
   THEMES
========================================== */
body.theme-cyber {
    --bg-primary: #050508;
    --bg-secondary: #0a0a10;
    --text-primary: #f5f6fa;
    --text-secondary: #4d516b;
    --accent-blue: #00d2ff;
    --accent-pink: #ff007f;
    --border-subtle: rgba(0, 210, 255, 0.15);
}
body.theme-cyber .modal-content {
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.2);
}
body.theme-cyber .modal-input {
    border: 1px solid rgba(0, 210, 255, 0.3);
}
body.theme-cyber .modal-btn, body.theme-cyber .preset-btn {
    background: rgba(0, 210, 255, 0.1);
    border-color: var(--accent-blue);
}
body.theme-cyber .preset-btn:hover {
    background: rgba(0, 210, 255, 0.2);
    box-shadow: 0 4px 10px rgba(255, 0, 127, 0.1);
}
/* Sidebar Layout & History Items */
.history-item-container { display: flex; justify-content: space-between; align-items: center; border-left: 2px solid transparent; padding-right: 8px; margin-bottom: 2px; }
.history-item-container:hover { background-color: rgba(255, 255, 255, 0.03); }
.history-actions { display: flex; gap: 4px; opacity: 0.3; transition: opacity 0.2s; }
.history-item-container:hover .history-actions { opacity: 1; }
.history-icon { background: none; border: none; color: #4d516b; cursor: pointer; padding: 4px; transition: color 0.2s; }
.history-icon:hover { color: #ff007f; }
/* Modal Layout */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(10, 26, 18, 0.8); backdrop-filter: blur(8px); z-index: 10000; justify-content: center; align-items: center; }
.modal-content { background: #0a1a12; border: 1px solid #00ff88; box-shadow: 0 0 40px rgba(46, 204, 113, 0.15); width: 95%; max-width: 800px; max-height: 85vh; padding: 24px; border-radius: 8px; color: #d4efdf; display: flex; flex-direction: column; gap: 20px; }
.modal-header { font-size: 18px; font-weight: bold; color: #00ff88; border-bottom: 1px solid rgba(46, 204, 113, 0.2); padding-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.modal-body { overflow-y: auto; display: flex; flex-direction: column; gap: 24px; padding-right: 12px; }
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(46, 204, 113, 0.2); border-radius: 4px; }
.modal-group { display: flex; flex-direction: column; gap: 8px; }
.modal-input { background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(46, 204, 113, 0.3); color: #d4efdf; padding: 10px; border-radius: 4px; font-family: inherit; font-size: 0.9rem; transition: border-color 0.2s; }
.modal-input:focus { outline: none; border-color: #00ff88; }
.modal-btn { background: rgba(46, 204, 113, 0.1); color: #00ff88; border: 1px solid #00ff88; padding: 10px 18px; border-radius: 4px; cursor: pointer; font-weight: bold; text-transform: uppercase; transition: 0.2s; }
.modal-btn:hover { background: rgba(46, 204, 113, 0.3); transform: translateY(-1px); }

/* Settings Matrix Specifics */
.settings-section { background: rgba(46, 204, 113, 0.03); border: 1px solid rgba(46, 204, 113, 0.1); border-radius: 6px; padding: 20px; }
.settings-section h3 { font-size: 0.8rem; color: #00ff88; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 16px; border-bottom: 1px solid rgba(46, 204, 113, 0.1); padding-bottom: 8px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.settings-row { display: flex; gap: 12px; }
.settings-row .modal-group { flex: 1; }

.toggle-container { display: flex; align-items: center; justify-content: space-between; background: rgba(0,0,0,0.2); padding: 10px 14px; border: 1px solid rgba(46,204,113,0.1); border-radius: 4px; }
.toggle-label { font-size: 0.85rem; color: #d4efdf; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .3s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: #d4efdf; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: #00ff88; }
input:checked + .slider:before { transform: translateX(20px); background-color: #0a1a12; }

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; color: #d4efdf; }
.radio-label input[type="radio"] { accent-color: #00ff88; cursor: pointer; }
.mobile-close-btn { display: none; }

/* ==========================================
   MOBILE OPTIMIZATIONS
========================================== */
@media (max-width: 768px) {
    .main-container {
        padding: 12px;
        width: 100%;
        max-width: 100%;
    }
    .input-wrapper {
        padding: 12px;
        width: 100%;
        max-width: 100%;
    }
    .input-container {
        padding: 8px 12px;
        gap: 8px;
    }
    .action-btn {
        width: 36px;
        height: 36px;
    }
    .chat-input {
        font-size: 14px;
        height: auto;
    }
    .preset-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }
    .preset-btn {
        width: 100%;
        font-size: 12px;
        padding: 8px;
    }
    .message-content {
        font-size: 13.5px;
    }
    .message-row {
        padding: 12px;
    }
    .header {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    .modal-content {
        width: 95%;
        padding: 16px;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    /* MOBILE SIDEBAR OVERRIDE */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        width: 280px; /* ensure width on mobile */
        max-width: 85vw;
        border-right: 1px solid var(--border-color, rgba(46, 204, 113, 0.2));
        box-shadow: 5px 0 20px rgba(0,0,0,0.5);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .mobile-close-btn {
        display: block;
        position: absolute;
        top: 16px;
        right: 16px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 18px;
        font-weight: bold;
        cursor: pointer;
    }
    .mobile-close-btn:hover {
        color: var(--accent-pink, #ff007f);
    }
}
