:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-card: #334155;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
    --sidebar-width: 350px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.25rem;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle-btn:hover {
    background: var(--accent-blue);
    color: white;
    transform: scale(1.05);
}

/* Side Panel - Fixed Sidebar */
.side-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 350px;
    height: 100vh;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    transform: translateX(0);
}

.side-panel.collapsed {
    transform: translateX(-350px);
}

.side-panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
    position: sticky;

    z-index: 10;
}

.side-panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.accordion { flex: 1; }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.accordion-header:hover { background: rgba(59, 130, 246, 0.05); }
.accordion-header span:first-child { display: flex; align-items: center; gap: 0.5rem; }
.accordion-icon { transition: transform 0.3s; font-size: 0.75rem; }
.accordion-header.active .accordion-icon { transform: rotate(180deg); }
.accordion-content { padding: 1.5rem; display: none; background: var(--bg-dark); }
.accordion-content.active { display: block; }
.section-description { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 1.25rem; line-height: 1.5; }
.subsection { margin-bottom: 1.5rem; }
.subsection:last-child { margin-bottom: 0; }
.subsection h4 { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
.divider-text { text-align: center; color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; margin: 1.5rem 0; position: relative; }
.divider-text::before, .divider-text::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border); }
.divider-text::before { left: 0; }
.divider-text::after { right: 0; }
.api-key-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.api-key-row .input-with-toggle { flex: 1; }
.btn-remove { padding: 0.5rem 0.75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 0.375rem; color: var(--accent-red); cursor: pointer; transition: all 0.2s; font-size: 1rem; }
.btn-remove:hover { background: var(--accent-red); color: white; }
.btn-lock-key { padding: 0.5rem 0.75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 0.375rem; color: #10b981; cursor: pointer; transition: all 0.2s; font-size: 1rem; font-weight: bold; }
.btn-lock-key:hover { background: #10b981; color: white; transform: scale(1.05); }
.btn-lock-key.locked { background: #10b981; color: white; }
.label-prominent { font-weight: 600; font-size: 1rem; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.field-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; margin-bottom: 0; }
.optional-tag { font-size: 0.75rem; color: var(--text-muted); font-weight: normal; }
.lock-tooltip { position: absolute; background: #10b981; color: white; padding: 0.25rem 0.75rem; border-radius: 0.375rem; font-size: 0.75rem; font-weight: 600; animation: fadeInOut 2s ease-in-out; pointer-events: none; z-index: 1000; }
@keyframes fadeInOut { 0% { opacity: 0; transform: translateY(-10px); } 20% { opacity: 1; transform: translateY(0); } 80% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-10px); } }

/* File Drop Zone */
.file-drop-zone {
    position: relative;
    border: 2px dashed #475569;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    background: rgba(30, 41, 59, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}
.file-drop-zone.dragover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}
.file-drop-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}
.file-drop-zone .drop-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.file-drop-zone #drop-text {
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}
.file-drop-zone #drop-text strong {
    color: #3b82f6;
}

.session-log-actions { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
/* Main Dashboard - Fixed Sidebar Approach */
.main-dashboard { 
    margin-left: 350px;
    width: calc(100% - 350px);
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

/* Expand main content when sidebar is collapsed */
body.sidebar-closed .main-dashboard {
    margin-left: 0;
    width: 100%;
}
.status-bar { background: var(--bg-panel); border-bottom: 1px solid var(--border); padding: 1rem 2rem; position: sticky; top: 0; z-index: 100; }
.status-indicators { display: flex; gap: 1rem; flex-wrap: wrap; }
.status-badge { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: var(--bg-card); border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-secondary); animation: pulse 2s ease-in-out infinite; }
.status-dot.online { background: var(--accent-green); }
.status-dot.offline { background: var(--accent-red); animation: none; }
.status-dot.active { background: var(--accent-blue); }
.status-dot.inactive { background: var(--text-secondary); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.dashboard-content { flex: 1; padding: 2rem; max-width: 1200px; margin: 0 auto; width: 100%; }
.dashboard-content h1 { font-size: 2rem; margin-bottom: 2rem; background: linear-gradient(135deg, var(--accent-blue), var(--accent-green)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.preview-section { margin-bottom: 2rem; }
.preview-container { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 0.75rem; margin-bottom: 1rem; overflow: hidden; }
.preview-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--bg-card); }
.preview-title { display: flex; align-items: center; gap: 0.75rem; font-size: 0.95rem; font-weight: 500; }
.stream-badge { padding: 0.25rem 0.75rem; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 1rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.stream-badge.connected { background: rgba(16, 185, 129, 0.1); border-color: var(--accent-green); color: var(--accent-green); }
.preview-content { position: relative; min-height: 300px; display: flex; align-items: center; justify-content: center; }
#screen-video { width: 100%; height: auto; display: none; }
#screen-video.active { display: block; }
.preview-placeholder { text-align: center; color: var(--text-secondary); }
.placeholder-icon { font-size: 4rem; margin-bottom: 1rem; opacity: 0.5; }
.placeholder-hint { font-size: 0.875rem; margin-top: 0.5rem; }
.control-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }
/* Results Section */
.results-section { margin-bottom: 2rem; }
.results-section h2 { font-size: 1.5rem; margin-bottom: 1rem; color: var(--text-primary); }
.metadata-pills { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.pill { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 0.5rem; }
.pill-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; }
.pill-value { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.pill.trap-detected { border-color: var(--accent-red); background: rgba(239, 68, 68, 0.1); }
.pill.trap-detected .pill-value { color: var(--accent-red); }
.result-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 0.75rem; padding: 1.5rem; margin-bottom: 1.5rem; }
.result-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-primary); }
.result-content { color: var(--text-secondary); line-height: 1.7; }
.answer-card { border-color: var(--accent-blue); }
.answer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 1rem; }
.answer-badges { display: flex; align-items: center; gap: 0.5rem; }
.answer-content { font-size: 1.125rem; font-weight: 500; color: var(--text-primary); }
.placeholder-text { color: var(--text-secondary); font-style: italic; }
/* Forms & Inputs */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group select { padding: 0.75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 0.375rem; color: var(--text-primary); font-size: 0.875rem; transition: all 0.2s; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.form-group select { cursor: pointer; }
.file-input { cursor: pointer; }
.input-with-toggle { display: flex; gap: 0.5rem; }
.input-with-toggle input { flex: 1; font-family: monospace; }
.toggle-visibility { padding: 0.5rem 0.75rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 0.375rem; color: var(--text-primary); cursor: pointer; font-size: 1rem; transition: all 0.2s; }
.toggle-visibility:hover { background: var(--bg-panel); }
/* Buttons */
.btn { padding: 0.75rem 1.5rem; border: none; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.5rem; justify-content: center; }
.btn-primary { background: var(--accent-blue); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-primary:disabled { background: var(--bg-card); color: var(--text-secondary); cursor: not-allowed; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-panel); }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-card); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 0.25rem; font-size: 1rem; transition: color 0.2s; }
.btn-icon:hover { color: var(--accent-blue); }
/* History List */
.history-list { max-height: 400px; overflow-y: auto; }
.history-empty { text-align: center; padding: 2rem; color: var(--text-secondary); }
.history-hint { font-size: 0.875rem; margin-top: 0.5rem; }
.history-item { padding: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 0.5rem; margin-bottom: 0.75rem; font-size: 0.8125rem; }
.history-item:last-child { margin-bottom: 0; }
.history-timestamp { color: var(--text-secondary); font-size: 0.75rem; margin-bottom: 0.5rem; }
.history-question { color: var(--text-primary); margin-bottom: 0.25rem; }
.history-answer { color: var(--accent-blue); font-weight: 500; }
/* Status Messages */
.status-msg { font-size: 0.875rem; padding: 0.75rem 1rem; border-radius: 0.375rem; font-weight: 500; margin-top: 1rem; }
.status-msg.loading { color: var(--accent-yellow); background: rgba(245, 158, 11, 0.1); border: 1px solid var(--accent-yellow); animation: pulse 2s ease-in-out infinite; }
.status-msg.success { color: var(--accent-green); background: rgba(16, 185, 129, 0.1); border: 1px solid var(--accent-green); }
.status-msg.error { color: var(--accent-red); background: rgba(239, 68, 68, 0.1); border: 1px solid var(--accent-red); }
.badge { padding: 0.25rem 0.75rem; border-radius: 0.25rem; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); border: 1px solid var(--accent-green); }
/* Footer */
.footer { background: var(--bg-panel); border-top: 1px solid var(--border); padding: 1.5rem 2rem; text-align: center; font-size: 0.875rem; color: var(--text-secondary); }
.footer-hint { margin-top: 0.5rem; }
/* Hamburger Menu */
.hamburger-toggle { display: none; position: fixed; top: 1rem; left: 1rem; z-index: 300; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.75rem; cursor: pointer; flex-direction: column; gap: 0.25rem; }
.hamburger-toggle span { width: 1.5rem; height: 2px; background: var(--text-primary); transition: all 0.3s; }
/* Responsive Design */
@media (max-width: 1024px) { :root { --sidebar-width: 300px; } }
@media (max-width: 768px) {
    .hamburger-toggle { display: flex; }
    .side-panel { 
        transform: translateX(-350px);
        transition: transform 0.3s ease;
    }
    .side-panel.open { 
        transform: translateX(0); 
    }
    .main-dashboard {
        margin-left: 0;
        width: 100%;
    }
}

/* ============================================
   Subscription Gate Overlay Styles
   ============================================ */

.subscription-gate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.subscription-gate.hidden {
    display: none !important;
}

/* Modal Status Message Styles */
.modal-status {
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    font-weight: 500;
}

.modal-status.hidden {
    display: none;
}

.modal-status.pending {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.modal-status.error {
    background: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

.modal-status.loading {
    background: #e2e8f0;
    color: #1e293b;
}


.gate-content {
    max-width: 500px;
    width: 90%;
    padding: 1rem;
}

.gate-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.gate-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gate-header h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.gate-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.gate-body {
    margin-bottom: 2rem;
}

.status-banner {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.status-banner.hidden {
    display: none;
}

.status-banner.pending {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--accent-yellow);
    color: var(--accent-yellow);
}

.status-banner.suspended {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.status-banner.banned {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.signin-overlay-container {
    text-align: center;
}

.signin-prompt {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.gate-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.gate-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

/* Locked Workspace Styles */
.locked-view {
    pointer-events: none;
    opacity: 0.45;
    filter: grayscale(0.5);
    user-select: none;
    transition: opacity 0.3s ease;
}

.locked-view.unlocked {
    pointer-events: auto;
    opacity: 1;
    filter: none;
    user-select: auto;
    transition: all 0.5s ease;
}

/* Status Banner Styles */
.status-banner {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    line-height: 1.5;
}

.status-banner.hidden {
    display: none;
}

/* Pending Status - Amber/Yellow */
.status-banner.pending {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #78350f;
    border: 2px solid #fbbf24;
}

/* Banned/Paused Status - Red */
.status-banner.banned,
.status-banner.paused {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #7f1d1d;
    border: 2px solid #ef4444;
}

/* Active/Approved Status - Green */
.status-banner.active,
.status-banner.approved {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #10b981;
}
    .status-bar { padding: 1rem; }
    .dashboard-content { padding: 1rem; }
    .control-buttons { flex-direction: column; }
    .btn { width: 100%; }
    .metadata-pills { flex-direction: column; }
    .answer-header { flex-direction: column; align-items: flex-start; }
    .session-log-actions { flex-direction: column; }
    .session-log-actions .btn { width: 100%; }
}
/* Scrollbar Styling */
.side-panel::-webkit-scrollbar, .history-list::-webkit-scrollbar { width: 8px; }
.side-panel::-webkit-scrollbar-track, .history-list::-webkit-scrollbar-track { background: var(--bg-dark); }
.side-panel::-webkit-scrollbar-thumb, .history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.side-panel::-webkit-scrollbar-thumb:hover, .history-list::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }


