/* =========================================================================
   THEME TOKENS — dark (default)
   ========================================================================= */
:root {
    /* base surfaces */
    --bg-base:           #0a0a0a;
    --bg-gradient-mid:   #121212;
    --surface-raised:    #1a1a1a;
    --shell-gradient:    linear-gradient(135deg, #0a0a0a 0%, #121212 50%, #0a0a0a 100%);

    /* text */
    --text-primary:      #e8e8e8;
    --text-secondary:    #aaa;
    --text-tertiary:     #888;
    --text-muted:        #666;
    --text-placeholder:  #555;

    /* brand */
    --brand:                 #73ceb3;
    --brand-hover:           #8dd4c4;
    --brand-text-on-tint:    #b8f0e3;
    --brand-option-hover:    #2d4a42;
    --brand-tint-04:         rgba(115,206,179,0.04);
    --brand-tint-08:         rgba(115,206,179,0.08);
    --brand-tint-10:         rgba(115,206,179,0.10);
    --brand-tint-15:         rgba(115,206,179,0.15);
    --brand-tint-20:         rgba(115,206,179,0.20);
    --brand-border-30:       rgba(115,206,179,0.30);
    --brand-border-40:       rgba(115,206,179,0.40);
    --brand-border-50:       rgba(115,206,179,0.50);

    /* status (same in both modes) */
    --success:           #28a745;
    --success-hover:     #34c759;
    --danger:            #dc3545;
    --danger-hover:      #e4505f;
    --warning:           #f0b429;
    --info:              #73ceb3;

    /* surface tints (white-on-dark by default) */
    --surface-tint-02:   rgba(255,255,255,0.02);
    --surface-tint-03:   rgba(255,255,255,0.03);
    --surface-tint-04:   rgba(255,255,255,0.04);
    --surface-tint-05:   rgba(255,255,255,0.05);
    --surface-tint-06:   rgba(255,255,255,0.06);
    --surface-tint-08:   rgba(255,255,255,0.08);
    --surface-tint-12:   rgba(255,255,255,0.12);
    --surface-tint-25:   rgba(255,255,255,0.25);

    /* borders (semantic) */
    --border-soft:       rgba(255,255,255,0.06);
    --border-default:    rgba(255,255,255,0.10);
    --border-emphasis:   rgba(255,255,255,0.15);

    /* recessed insets */
    --inset-soft:        rgba(0,0,0,0.20);
    --inset-medium:      rgba(0,0,0,0.30);
    --inset-strong:      rgba(0,0,0,0.40);
    --scrim:             rgba(0,0,0,0.80);

    /* scrollbars */
    --scrollbar-thumb:        rgba(255,255,255,0.15);
    --scrollbar-thumb-hover:  rgba(255,255,255,0.25);

    /* shadows */
    --shadow-floating:   0 1px 5px rgba(0,0,0,.4);
    --shadow-toast:      0 4px 12px rgba(0,0,0,.3);
    --shadow-dropdown:   0 4px 12px rgba(0,0,0,.4);
    --shadow-panel:      0 8px 24px rgba(0,0,0,.4);
    --shadow-modal:      0 20px 60px rgba(0,0,0,.5);
    --shadow-focus-glow: 0 0 12px rgba(115,206,179,.15);

    /* toast tints (dark) */
    --toast-success-bg:  #1a3a2a;
    --toast-success-fg:  #8dd4a0;
    --toast-error-bg:    #3a1a1a;
    --toast-error-fg:    #e88;
    --toast-info-bg:     #1a2a3a;
    --toast-info-fg:     #8dd4c4;
    --toast-warning-bg:  #3a3a1a;
    --toast-warning-fg:  #f5d98a;

    color-scheme: dark;
}

/* =========================================================================
   THEME TOKENS — light overrides
   ========================================================================= */
[data-theme="light"] {
    --bg-base:           #f5f5f5;
    --bg-gradient-mid:   #fafafa;
    --surface-raised:    #ffffff;
    --shell-gradient:    linear-gradient(135deg, #f5f5f5 0%, #fafafa 50%, #f5f5f5 100%);

    --text-primary:      #111111;
    --text-secondary:    #444;
    --text-tertiary:     #777;
    --text-muted:        #999;
    --text-placeholder:  #aaa;

    --brand:                 #5ab89e;
    --brand-hover:           #73ceb3;
    --brand-text-on-tint:    #1a5e4c;
    --brand-option-hover:    #d6efe6;
    --brand-tint-04:         rgba(115,206,179,0.06);
    --brand-tint-08:         rgba(115,206,179,0.10);
    --brand-tint-10:         rgba(115,206,179,0.12);
    --brand-tint-15:         rgba(115,206,179,0.18);
    --brand-tint-20:         rgba(115,206,179,0.22);
    --brand-border-30:       rgba(115,206,179,0.35);
    --brand-border-40:       rgba(115,206,179,0.45);
    --brand-border-50:       rgba(115,206,179,0.55);

    --surface-tint-02:   rgba(0,0,0,0.02);
    --surface-tint-03:   rgba(0,0,0,0.03);
    --surface-tint-04:   rgba(0,0,0,0.04);
    --surface-tint-05:   rgba(0,0,0,0.05);
    --surface-tint-06:   rgba(0,0,0,0.06);
    --surface-tint-08:   rgba(0,0,0,0.08);
    --surface-tint-12:   rgba(0,0,0,0.10);
    --surface-tint-25:   rgba(0,0,0,0.20);

    --border-soft:       rgba(0,0,0,0.06);
    --border-default:    rgba(0,0,0,0.10);
    --border-emphasis:   rgba(0,0,0,0.14);

    --inset-soft:        rgba(0,0,0,0.03);
    --inset-medium:      rgba(0,0,0,0.04);
    --inset-strong:      rgba(0,0,0,0.05);
    --scrim:             rgba(0,0,0,0.40);

    --scrollbar-thumb:        rgba(0,0,0,0.15);
    --scrollbar-thumb-hover:  rgba(0,0,0,0.25);

    --shadow-floating:   0 1px 3px rgba(0,0,0,.08);
    --shadow-toast:      0 4px 12px rgba(0,0,0,.10);
    --shadow-dropdown:   0 4px 12px rgba(0,0,0,.12);
    --shadow-panel:      0 8px 24px rgba(0,0,0,.10);
    --shadow-modal:      0 20px 60px rgba(0,0,0,.18);
    --shadow-focus-glow: 0 0 12px rgba(115,206,179,.20);

    --toast-success-bg:  #e6f4ea;
    --toast-success-fg:  #1f6f33;
    --toast-error-bg:    #fbeaec;
    --toast-error-fg:    #a02430;
    --toast-info-bg:     #e6f0f7;
    --toast-info-fg:     #1f5f7a;
    --toast-warning-bg:  #fdf3da;
    --toast-warning-fg:  #8a6313;

    color-scheme: light;
}

/* =========================================================================
   RESET & BASE
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; accent-color: #73ceb3; }
html, body {
    min-height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
}

/* --- no native blue --- */
select { background-color: var(--surface-raised) !important; color: var(--text-primary) !important; accent-color: #73ceb3; }
select option { background-color: var(--surface-raised) !important; color: var(--text-primary) !important; }
select option:checked, select option:hover { background-color: var(--brand-option-hover) !important; color: var(--brand-text-on-tint) !important; }

/* --- app shell --- */
.app-container {
    display: flex; flex-direction: column;
    height: 100vh; padding: 16px; overflow: hidden;
    background: var(--shell-gradient);
}
.header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 12px; margin-bottom: 12px;
    border-bottom: 1px solid var(--border-default);
}

/* =========================================================================
   COMPONENTS
   ========================================================================= */

/* --- buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: 6px;
    font-size: 12px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.3px;
    cursor: pointer; transition: all 0.2s ease;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-primary  { background: var(--brand); color: #0a0a0a; }
.btn-primary:hover:not(:disabled)  { background: var(--brand-hover); }
.btn-outline  { background: transparent; border: 1px solid var(--brand-border-40); color: var(--brand); }
.btn-outline:hover:not(:disabled)  { background: var(--brand-tint-10); border-color: var(--brand); }
.btn-secondary{ background: var(--surface-tint-08); border: 1px solid var(--border-default); color: var(--text-secondary); }
.btn-secondary:hover:not(:disabled){ background: var(--surface-tint-12); color: var(--text-primary); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled)  { background: var(--success-hover); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)   { background: var(--danger-hover); }

/* --- form --- */
.form-group { margin-bottom: 10px; }
.form-group label {
    display: block; font-size: 10px; color: var(--text-tertiary); margin-bottom: 4px;
    text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600;
}
.form-control {
    width: 100%; padding: 8px 10px;
    background: var(--inset-medium); border: 1px solid var(--border-default); border-radius: 6px;
    color: var(--text-primary); font-size: 12px; font-family: inherit;
    transition: border-color 0.2s ease;
}
.form-control:focus { outline: none; border-color: var(--brand-border-50); box-shadow: var(--shadow-focus-glow); }
.form-control::placeholder { color: var(--text-placeholder); }
textarea.form-control { resize: vertical; min-height: 80px; font-family: 'Consolas', monospace; font-size: 11px; }

/* --- panel --- */
.panel { background: var(--surface-tint-03); border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px; }
.panel-title { font-size: 11px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }

/* --- tabs --- */
.tabs-container { display: flex; gap: 4px; border-bottom: 1px solid var(--border-default); }
.tab-btn { padding: 10px 20px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--text-tertiary); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s ease; text-transform: uppercase; letter-spacing: 0.5px; }
.tab-btn:hover { color: var(--brand); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-content { display: none; flex: 1; min-height: 0; overflow: hidden; }
.tab-content.active { display: flex; flex-direction: column; }

/* --- scrollbars --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* --- toasts --- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-toast); animation: slideIn 0.25s ease-out; }
.toast-success { background: var(--toast-success-bg); border-left: 3px solid var(--success); color: var(--toast-success-fg); }
.toast-error   { background: var(--toast-error-bg);   border-left: 3px solid var(--danger);  color: var(--toast-error-fg); }
.toast-info    { background: var(--toast-info-bg);    border-left: 3px solid var(--brand);   color: var(--toast-info-fg); }
.toast-warning { background: var(--toast-warning-bg); border-left: 3px solid var(--warning); color: var(--toast-warning-fg); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
