@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #0a0e1a;
    --panel-bg: rgba(15, 23, 42, 0.55);
    --panel-border: rgba(255, 255, 255, 0.07);
    --text-primary: #e8ecf4;
    --text-secondary: #7a8ba8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --input-bg: rgba(10, 15, 30, 0.7);
    --sidebar-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 10% 0%, rgba(59,130,246,0.08), transparent 50%),
        radial-gradient(ellipse at 90% 100%, rgba(16,185,129,0.05), transparent 50%);
}

/* ======================== LAYOUT ======================== */
.layout { display: flex; min-height: 100vh; }

/* ======================== SIDEBAR ======================== */
.sidebar {
    width: var(--sidebar-w);
    background: rgba(10, 14, 26, 0.95);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--panel-border);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.sidebar-header p {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 0.15rem;
}

.nav-links {
    list-style: none;
    padding: 0.5rem 0;
    flex: 1;
    overflow-y: auto;
}

.nav-links li {
    padding: 0.7rem 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links li:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
}

.nav-links li.active {
    background: rgba(59,130,246,0.08);
    color: #93bbfc;
    border-left-color: var(--accent);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--panel-border);
}

/* ======================== CONTENT ======================== */
.content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 1.5rem 2rem;
    max-width: 1100px;
}

/* ======================== TAB PANES ======================== */
.tab-pane { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
}

/* ======================== GRID ======================== */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 1rem; }
}

/* ======================== CARD ======================== */
.card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

/* ======================== INPUTS ======================== */
textarea, input[type="text"], input[type="number"], input[type="password"] {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0.4rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}

textarea:focus, input:focus { border-color: rgba(59,130,246,0.5); }

textarea { resize: vertical; min-height: 100px; }

select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0.4rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}

label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ======================== BUTTONS ======================== */
button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s;
    font-family: inherit;
}

button:hover { background: var(--accent-hover); }
button:active { transform: translateY(1px); }
button.danger { background: var(--danger); }
button.danger:hover { background: #dc2626; }
button.success { background: var(--success); }
button.success:hover { background: #059669; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.7rem; }

/* Loading state for heavy buttons */
button.btn-loading {
    opacity: 0.65;
    pointer-events: none;
    cursor: not-allowed;
    position: relative;
}
button.btn-loading:hover {
    background: var(--accent);
    transform: none;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ======================== FLEX ======================== */
.flex-row { display: flex; gap: 0.75rem; align-items: flex-end; }
.flex-1 { flex: 1; }

/* ======================== TERMINAL ======================== */
.terminal {
    background: rgba(5, 10, 20, 0.8);
    border-radius: 0.4rem;
    padding: 0.75rem;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.75rem;
    color: #34d399;
    height: 220px;
    overflow-y: auto;
    border: 1px solid var(--panel-border);
    line-height: 1.5;
}

.terminal p { margin: 0.1rem 0; }

/* ======================== AUTH FORM ======================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(0,0,0,0.15);
    padding: 0.75rem;
    border-radius: 0.5rem;
}

/* ======================== ACCOUNT CARDS ======================== */
.account-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: rgba(0,0,0,0.15);
    border-radius: 0.4rem;
    border: 1px solid var(--panel-border);
    margin-bottom: 0.4rem;
    transition: border-color 0.15s;
}

.account-card:hover { border-color: rgba(255,255,255,0.12); }

.account-info { flex: 1; min-width: 0; }

.account-name { font-weight: 600; font-size: 0.85rem; }
.account-session { font-size: 0.72rem; color: var(--text-secondary); }

.account-status {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: 1rem;
    flex-shrink: 0;
    font-weight: 500;
}

.status-active { background: rgba(16,185,129,0.12); color: #34d399; }
.status-inactive { background: rgba(239,68,68,0.12); color: #f87171; }
.status-disabled { background: rgba(245,158,11,0.12); color: #fbbf24; }

.account-actions { flex-shrink: 0; display: flex; gap: 0.25rem; }
.account-actions button { padding: 0.25rem 0.5rem; font-size: 0.65rem; border-radius: 0.3rem; }

/* ======================== PROGRESS BAR ======================== */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.progress-stats span { white-space: nowrap; }

/* ======================== STAT CARDS ======================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stat-box {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0.75rem;
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.stat-title {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* ======================== TABLES ======================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.data-table th {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--panel-border);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ======================== WARMUP STEPS ======================== */
.warmup-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.warmup-step {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.5rem 0.6rem;
    background: rgba(0,0,0,0.12);
    border-radius: 0.4rem;
    border-left: 2px solid var(--panel-border);
}

.warmup-step-icon { font-size: 1rem; flex-shrink: 0; line-height: 1.4; }

.warmup-step-text { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }
.warmup-step-text strong { color: var(--text-primary); font-weight: 600; }

/* ======================== BADGE ======================== */
.badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    background: var(--panel-border);
    color: var(--text-secondary);
}

.badge-active { background: rgba(16,185,129,0.15); color: #34d399; }

/* ======================== MISC ======================== */
code {
    background: rgba(59,130,246,0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.78rem;
    color: #93c5fd;
}

.collapsible-container {
    max-height: 180px;
    overflow-y: auto;
    background: var(--input-bg);
    border-radius: 0.4rem;
    padding: 0.4rem;
    border: 1px solid var(--panel-border);
}

/* ======================== PULSE INDICATOR ======================== */
.pulse-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    margin-left: 5px;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ======================== HELP BLOCKS ======================== */
.help-block {
    background: var(--panel-bg);
    border: 1px solid rgba(96, 165, 250, 0.15);
    border-radius: 0.75rem;
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.help-block:hover {
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.06);
}
.help-block[open] {
    border-color: rgba(96, 165, 250, 0.25);
    box-shadow: 0 4px 24px rgba(59, 130, 246, 0.08);
}

/* ---- Summary trigger ---- */
.help-block summary {
    padding: 0.85rem 1.15rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.25s;
    border-left: 3px solid transparent;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(167, 139, 250, 0.04));
}
.help-block summary::-webkit-details-marker { display: none; }
.help-block summary:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(167, 139, 250, 0.08));
    border-left-color: var(--accent);
}
.help-block[open] summary {
    border-left-color: var(--accent);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.10), rgba(167, 139, 250, 0.06));
}

/* ---- Animated chevron ---- */
.help-block summary::after {
    content: '›';
    margin-left: auto;
    font-size: 1.1rem;
    font-weight: 700;
    opacity: 0.35;
    transition: transform 0.3s ease, opacity 0.3s;
    transform: rotate(0deg);
    color: var(--accent);
}
.help-block:hover summary::after { opacity: 0.7; }
.help-block[open] summary::after {
    transform: rotate(90deg);
    opacity: 0.8;
}

/* ---- Content body ---- */
.help-content {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    animation: helpSlideIn 0.25s ease;
}
@keyframes helpSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Steps list ---- */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.help-step {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 0.5rem 0.6rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s, border-color 0.2s;
}
.help-step:hover {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.06);
}
.help-step strong { color: var(--text-primary); }

/* ---- Gradient number badge ---- */
.help-num {
    min-width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    border-radius: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    letter-spacing: -0.5px;
}

/* ---- Tip / warning box ---- */
.help-tip {
    margin-top: 1rem;
    padding: 0.7rem 0.85rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(251, 191, 36, 0.04));
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-radius: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    position: relative;
    overflow: hidden;
}
.help-tip::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #f59e0b, #f97316);
    border-radius: 3px 0 0 3px;
}
.help-tip strong { color: #fbbf24; }

/* ---- Code snippets inside help ---- */
.help-tip code, .help-step code {
    background: rgba(147, 197, 253, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
    font-size: 0.78rem;
    color: #93c5fd;
    border: 1px solid rgba(147, 197, 253, 0.12);
    font-family: 'Inter', monospace;
}

/* ---- Links inside help ---- */
.help-step a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed rgba(59, 130, 246, 0.4);
    transition: border-color 0.2s;
}
.help-step a:hover {
    border-bottom-color: var(--accent);
}

/* ======================== TOAST NOTIFICATIONS ======================== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fecaca;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.9rem;
    min-width: 250px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-fadeout {
    animation: toastFadeOut 0.5s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

