/* ═══════════════════════════════════════════════════════════════
   BIZZIBEES CHANNEL COMMANDER - Mission Control Theme
   Dark theme, amber/gold accents, data-dense Bloomberg-style
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0a0b0e;
    --bg-secondary: #12141a;
    --bg-card: #161820;
    --bg-card-hover: #1c1e28;
    --bg-input: #1a1c25;
    --border: #252833;
    --border-active: #d4a843;
    --text-primary: #e8e6e3;
    --text-secondary: #8b8d97;
    --text-muted: #555766;
    --accent: #d4a843;
    --accent-dim: #d4a84333;
    --accent-glow: #d4a84366;
    --success: #34d399;
    --success-dim: #34d39922;
    --warning: #fbbf24;
    --warning-dim: #fbbf2422;
    --danger: #f87171;
    --danger-dim: #f8717122;
    --info: #60a5fa;
    --info-dim: #60a5fa22;
    --purple: #a78bfa;
    --purple-dim: #a78bfa22;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── LAYOUT ────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), #f5c842);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #000;
    letter-spacing: -1px;
}

.brand-text h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.brand-text span {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.sidebar-section {
    padding: 16px 12px 8px;
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 10px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 450;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

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

.sidebar-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-link .icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    opacity: 0.7;
}

.sidebar-link.active .icon { opacity: 1; }

.sidebar-link .badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.badge-soon {
    background: var(--purple-dim);
    color: var(--purple);
}

.badge-live {
    background: var(--success-dim);
    color: var(--success);
}

/* ── MAIN CONTENT ──────────────────────────────────────────── */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.main-body {
    padding: 24px 28px;
}

/* ── CARDS ─────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--card-accent, var(--accent));
    opacity: 0.6;
}

.stat-card:hover {
    border-color: var(--border-active);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.stat-label {
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.stat-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── CONTENT CARDS ─────────────────────────────────────────── */

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.card-body {
    padding: 16px 20px;
}

.card-full {
    grid-column: 1 / -1;
}

/* ── PIPELINE TABLE ────────────────────────────────────────── */

.pipeline-table {
    width: 100%;
    border-collapse: collapse;
}

.pipeline-table th {
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.pipeline-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}

.pipeline-table tr:last-child td { border-bottom: none; }

.pipeline-table tr:hover td {
    background: var(--bg-card-hover);
}

/* ── STATUS BADGES ─────────────────────────────────────────── */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-generated { background: var(--success-dim); color: var(--success); }
.status-generated .status-dot { background: var(--success); }
.status-pending { background: var(--warning-dim); color: var(--warning); }
.status-pending .status-dot { background: var(--warning); }
.status-generating { background: var(--info-dim); color: var(--info); }
.status-generating .status-dot { background: var(--info); animation: pulse 1.5s infinite; }
.status-failed { background: var(--danger-dim); color: var(--danger); }
.status-failed .status-dot { background: var(--danger); }
.status-uploaded { background: var(--purple-dim); color: var(--purple); }
.status-uploaded .status-dot { background: var(--purple); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── BUTTONS ───────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 550;
    font-family: 'Outfit', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: #e5b94e;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid transparent;
}

.btn-danger:hover {
    border-color: var(--danger);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ── PROGRESS BARS ─────────────────────────────────────────── */

.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-fill.accent { background: var(--accent); }
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }
.progress-fill.info { background: var(--info); }

/* ── LOG VIEWER ────────────────────────────────────────────── */

.log-viewer {
    background: #0c0d10;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.7;
    max-height: 500px;
    overflow-y: auto;
    color: var(--text-secondary);
}

.log-line { white-space: pre-wrap; word-break: break-all; }
.log-info { color: var(--info); }
.log-warn { color: var(--warning); }
.log-error { color: var(--danger); }
.log-success { color: var(--success); }

/* ── SCHEDULE GRID ─────────────────────────────────────────── */

.schedule-slot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.schedule-slot:hover { background: var(--bg-card-hover); }
.schedule-slot:last-child { border-bottom: none; }

.slot-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--accent);
    min-width: 90px;
    font-weight: 600;
}

.slot-niche {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.slot-status {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── CLOUDFLARE ACCOUNTS ───────────────────────────────────── */

.cf-account {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.cf-account:last-child { border-bottom: none; }

.cf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.cf-name {
    font-size: 13px;
    font-weight: 600;
}

.cf-usage {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── FORM ELEMENTS ─────────────────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b8d97' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ── CALENDAR ──────────────────────────────────────────────── */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-header {
    padding: 10px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    min-height: 90px;
    transition: all 0.15s;
}

.cal-day:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.cal-day.today .cal-day-num {
    color: var(--accent);
}

.cal-event {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 3px;
    margin-bottom: 2px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-event.niche-dyk { background: var(--info-dim); color: var(--info); }
.cal-event.niche-psy { background: var(--purple-dim); color: var(--purple); }
.cal-event.niche-mot { background: var(--accent-dim); color: var(--accent); }
.cal-event.niche-art { background: #ec489922; color: #ec4899; }
.cal-event.niche-classic { background: var(--success-dim); color: var(--success); }
.cal-event.niche-health { background: #14b8a622; color: #14b8a6; }
.cal-event.niche-history { background: var(--warning-dim); color: var(--warning); }

/* ── COMING SOON PLACEHOLDER ───────────────────────────────── */

.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.coming-soon-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.coming-soon h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.coming-soon p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 400px;
}

/* ── TOGGLE SWITCH ─────────────────────────────────────────── */

.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 11px;
    transition: background 0.2s;
}

.toggle input:checked + .toggle-track { background: var(--accent); }

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle input:checked ~ .toggle-thumb { transform: translateX(18px); }

/* ── MOBILE HAMBURGER ──────────────────────────────────────── */

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 18px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
}

/* ── TOAST NOTIFICATION ────────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    min-width: 280px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── RESPONSIVE ────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show { display: block; }

    .hamburger { display: flex; }

    .main-content {
        margin-left: 0;
    }

    .main-body { padding: 16px; }
    .main-header { padding: 0 16px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }

    .content-grid { grid-template-columns: 1fr; }

    .calendar-grid { grid-template-columns: repeat(7, 1fr); }
    .cal-day { min-height: 60px; padding: 4px; }
    .cal-day-num { font-size: 11px; }
    .cal-event { font-size: 8px; padding: 1px 3px; }

    .pipeline-table { font-size: 12px; }
    .pipeline-table th, .pipeline-table td { padding: 10px 8px; }

    .schedule-slot { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .header-time { display: none; }
}
