/* ═══════════════════════════════════════════════
   WAWAN BOT COMMAND CENTER — BTN Professional Blue Theme
   Inspired by BTN (Bank Tabungan Negara)
   ═══════════════════════════════════════════════ */

:root {
    --bg-primary: #f8fafc;       /* Light Blue-Gray Background */
    --bg-secondary: #ffffff;     /* White Background */
    --bg-card: #ffffff;          /* White Card */
    --bg-hover: #f1f5f9;
    --border: #e2e8f0;           /* Soft Border */
    --border-active: #004e9c;    /* BTN Blue */
    --text-primary: #1e293b;     /* Dark Navy Slate */
    --text-secondary: #475569;
    --text-dim: #94a3b8;
    --accent: #004e9c;           /* BTN Blue */
    --accent-red: #ee2e24;       /* BTN Red */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --white: #ffffff;
    --radius: 12px;
    --radius-sm: 6px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}


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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ═══ LOGIN ═══ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f1f5f9;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 48px 40px;
    text-align: center;
    width: 420px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.login-logo { font-size: 64px; margin-bottom: 16px; }
.login-card h1 { color: var(--accent); font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.login-card p { color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }

.login-card input {
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    margin-bottom: 20px;
}

.login-card input:focus { border-color: var(--accent); }

.login-card button {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-card button:hover { background: #003d7a; }


/* ═══ TOPBAR ═══ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 64px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left .logo { font-size: 32px; }
.topbar-left h1 { font-size: 20px; font-weight: 800; color: var(--accent); }
.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    background: var(--accent-red);
    border-radius: 4px;
    color: white;
}

.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--text-secondary); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.online { background: var(--success); }
.btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); }
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--accent);
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}
.menu-toggle:hover { background: var(--bg-hover); }


/* ═══ LAYOUT ═══ */
.layout { display: flex; min-height: calc(100vh - 56px); }

/* ═══ SIDEBAR ═══ */
.sidebar {
    width: 250px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    max-height: calc(100vh - 64px);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-item:hover { background: #f8fafc; color: var(--accent); }
.nav-item.active {
    background: #eff6ff;
    color: var(--accent);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
}

.nav-icon { font-size: 20px; width: 28px; }


/* ═══ CONTENT ═══ */
.content { flex: 1; padding: 24px; overflow-y: auto; }

/* ═══ STATS CARDS ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }


.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-value { font-size: 28px; font-weight: 800; display: block; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* ═══ PANELS ═══ */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.panels.thirds { grid-template-columns: 1fr 1fr 1fr; }

.panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.panel-header h3 { font-size: 14px; font-weight: 600; }

.live-badge {
    font-size: 11px;
    color: var(--success);
    font-weight: 600;
    animation: pulse 2s infinite;
}

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

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

/* ═══ LOG VIEWER ═══ */
.log-viewer-container {
    padding: 0;
    background: #0f172a;
    border-radius: 0 0 12px 12px;
}

.log-viewer {
    height: 600px;
    overflow-y: auto;
    padding: 20px;
    margin: 0;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* ═══ CHART ═══ */
.chart-container { height: 320px; padding: 12px; background: white; border-radius: 12px; }


/* ═══ QUICK CONTROLS ═══ */
.controls-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.control-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-item label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* Toggle Switch */
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 26px;
    transition: 0.3s;
}
.toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(22px); background: white; }

/* Select */
select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

select:focus { border-color: var(--accent); }

.stat-mini { font-size: 20px; font-weight: 700; color: var(--accent); }

/* ═══ DATA TABLE ═══ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead { position: sticky; top: 0; }

.data-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(55, 65, 81, 0.2);
    color: var(--text-secondary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* ═══ BUTTONS ═══ */
.btn {
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #0099cc);
    border: none;
    color: white;
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3); color: white; }

.btn-danger { background: var(--danger); border: none; color: white; }
.btn-danger:hover { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); }

.btn-small { padding: 4px 10px; font-size: 11px; }

/* ═══ PAGE HEADER ═══ */
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header .page-title { margin-bottom: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.page-actions input {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    width: 260px;
}
.page-actions input:focus { border-color: var(--accent); }

/* ═══ SETTINGS GRID ═══ */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.setting-item label { font-size: 13px; font-weight: 500; }
.setting-item .setting-value { font-size: 13px; color: var(--accent); font-family: monospace; }

/* ═══ USER LIST ═══ */
.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(55, 65, 81, 0.2);
    font-size: 13px;
    gap: 12px;
    transition: background 0.2s;
}

.user-item:hover { background: var(--bg-hover); margin: 0 -20px; padding: 10px 20px; border-radius: var(--radius-sm); }

.user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-item .user-id { font-family: monospace; color: var(--text-dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-muted { color: var(--text-dim); font-weight: 400; font-style: italic; }
.user-actions { display: flex; gap: 4px; flex-shrink: 0; }

.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(0, 212, 255, 0.05); }

/* ═══ INSTRUCTION ITEM ═══ */
.instruction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 8px;
}

.instruction-item.inactive { opacity: 0.5; }
.instruction-text { flex: 1; font-size: 13px; margin-right: 16px; }
.instruction-actions { display: flex; gap: 6px; }

/* ═══ EMPTY STATE ═══ */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); font-size: 14px; }

/* ═══ TOAST ═══ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    z-index: 9999;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow);
}

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

@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(16px); } }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(55, 65, 81, 0.5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.5); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1200px) {
    .panels.thirds { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .panels { grid-template-columns: 1fr; }
    .panels.thirds { grid-template-columns: 1fr; }
    .controls-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .system-monitor-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .topbar-right span:not(#clockDisplay):not(#statusDot) { display: none; }
    .topbar-right .divider { display: none; }
    .topbar-left h1 { font-size: 16px; }
    .sidebar { width: 200px; }
    .nav-text { font-size: 13px; }
}

@media (max-width: 600px) {
    .menu-toggle { display: block; }
    .sidebar {
        position: fixed;
        left: -260px;
        top: 64px;
        bottom: 0;
        z-index: 999;
        width: 260px;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
        transition: transform 0.3s ease;
    }
    .sidebar.active { transform: translateX(260px); }
    
    .content { padding: 16px; }
    .stat-cards { grid-template-columns: 1fr; }
    .system-monitor-row { grid-template-columns: 1fr; }
    .controls-grid { grid-template-columns: 1fr; }
    .topbar-left .logo { font-size: 24px; }
    .topbar-left h1 { display: none; }
    .login-card { width: 90%; padding: 32px 20px; }
    
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .page-actions { width: 100%; flex-direction: column; }
    .page-actions input { width: 100%; }
    
    /* Make tables scrollable on small screens */
    .panel-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 600px; }
    
    /* Grid adjustments */
    .grid-2 { grid-template-columns: 1fr; }
    
    /* Modal adjustment */
    .modal-card { width: 95vw; padding: 20px; }
}

/* ═══ NAV DIVIDER ═══ */
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 16px;
}

/* ═══ COST TABLE ═══ */
.cost-cell { color: var(--warning); font-weight: 600; font-family: monospace; }

/* ═══ MODEL EDITOR ═══ */
.model-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(55, 65, 81, 0.2);
    gap: 16px;
}

.model-label { font-size: 13px; font-weight: 600; white-space: nowrap; min-width: 140px; }

.model-value { display: flex; gap: 8px; align-items: center; flex: 1; }

.model-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: monospace;
    font-size: 12px;
    outline: none;
    transition: border-color 0.3s;
}
.model-input:focus { border-color: var(--accent); }

.model-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.model-select:focus { border-color: var(--accent); }

/* ═══ PLAN CARD ═══ */
.plan-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: transform 0.2s, box-shadow 0.3s;
}
.plan-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.plan-card.inactive { opacity: 0.5; }

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.plan-name { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.plan-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
}

.plan-details {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.plan-features {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 12px;
    font-style: italic;
}

.plan-actions { display: flex; gap: 6px; }

/* ═══ SUBSCRIBER ITEM ═══ */
.subscriber-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(55, 65, 81, 0.2);
}
/* ═══════════════════════════════
   MONITORING UI ELEMENTS
   ═══════════════════════════════ */
.status-select {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}
.status-select.pending { border-color: var(--warning); color: var(--warning); }
.status-select.processing { border-color: var(--accent); color: var(--accent); }
.status-select.resolved, .status-select.done { border-color: var(--success); color: var(--success); }

.input, .table-input {
    width: 100%;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--silver);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.input:focus, .table-input:focus {
    background: var(--white);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.status-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--silver);
    background: var(--white);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
}

/* ═══════════════════════════════
   SWITCH TOGGLE
   ═══════════════════════════════ */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--success); }
input:focus + .slider { box-shadow: 0 0 1px var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

/* ═══════════════════════════════
   STATUS BADGES
   ═══════════════════════════════ */
.status-badge {
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    font-weight: 500;
}

.status-badge.online { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid var(--success); }
.status-badge.offline { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid var(--danger); }

.subscriber-item.expired { opacity: 0.5; }

.sub-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sub-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sub-plan { font-size: 11px; color: var(--accent-secondary); }
.sub-expiry { font-size: 11px; color: var(--success); }
.subscriber-item.expired .sub-expiry { color: var(--danger); }
.sub-id { font-family: monospace; font-size: 10px; color: var(--text-dim); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* ═══ MODAL ═══ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow), 0 0 40px rgba(0, 212, 255, 0.1);
}

.modal-card h3 { font-size: 16px; font-weight: 700; }

/* ═══ FEATURE GRID ═══ */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.feature-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.feature-toggle:hover { border-color: var(--accent); background: rgba(0, 212, 255, 0.05); }

.feature-toggle input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.feature-check-label { font-size: 12px; font-weight: 600; white-space: nowrap; }
.feature-desc { font-size: 10px; color: var(--text-dim); }

/* ═══ FEATURE BADGES ═══ */
.plan-features-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }

.feature-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 8px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    color: var(--accent);
    white-space: nowrap;
}

/* ═══ SYSTEM MONITOR ═══ */
.system-monitor-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.system-status-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}

.status-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.status-label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.status-value { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    transition: width 0.5s ease;
}

.status-details { font-size: 11px; color: var(--text-dim); }
.status-info-text { font-size: 11px; color: var(--text-dim); font-style: italic; margin-top: 4px; }

/* ═══ FORM GRID (MODAL) ═══ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group.full-width { grid-column: span 2; }

.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.form-group input {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus { border-color: var(--accent); }

.price-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
}

.price-input-wrapper .currency { font-weight: 700; color: var(--success); margin-right: 8px; }
.price-input-wrapper input { border: none; padding: 10px 0; flex: 1; }

.text-dim { color: var(--text-dim); font-size: 11px; }

.feature-selector-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.feature-selector-section label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 700; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

.cost-cell {
    font-weight: 700;
    color: var(--accent);
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

@media (max-width: 900px) {
    .system-monitor-row { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: span 1; }
}

/* ═══════════════════════════════════════════
   FLOATING AI CHAT BUBBLE
   ═══════════════════════════════════════════ */

/* -- Bubble Button -- */
.chat-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent), #0066cc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 100, 200, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    user-select: none;
}
.chat-bubble:active { cursor: grabbing; }
.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0, 100, 200, 0.6);
}
.chat-bubble-icon { font-size: 28px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)); }
.chat-bubble-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: bubblePulse 2s infinite;
    pointer-events: none;
}
@keyframes bubblePulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* -- Chat Widget Panel -- */
.chat-widget {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 400px;
    height: 550px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    z-index: 10001;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0,0,0,0.05);
    overflow: hidden;
    animation: widgetSlideUp 0.3s ease;
}
.chat-widget.hidden { display: none; }

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

/* -- Header -- */
.chat-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--accent), #0066cc);
    color: white;
    flex-shrink: 0;
}
.chat-widget-header.draggable-handle {
    cursor: grab;
    user-select: none;
}
.chat-widget-header.draggable-handle:active {
    cursor: grabbing;
}
.chat-widget-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-avatar {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.chat-widget-title h4 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}
.chat-status {
    font-size: 11px;
    opacity: 0.8;
}
.chat-widget-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-persona-select {
    padding: 4px 8px;
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    outline: none;
}
.chat-persona-select option { color: #333; background: white; }
.chat-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.chat-close-btn:hover { background: rgba(255,255,255,0.35); }

/* -- Body (Messages Area) -- */
.chat-widget-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f1f5f9;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}
.chat-welcome-icon { font-size: 40px; display: block; margin-bottom: 10px; }
.chat-welcome p { font-size: 14px; margin: 0; }

/* -- Message Bubbles -- */
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    animation: msgPop 0.2s ease;
}
@keyframes msgPop {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent), #0077cc);
    color: white;
    border-radius: 14px 14px 2px 14px;
}
.chat-msg.bot {
    align-self: flex-start;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.chat-msg.bot code {
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

/* -- Attachment Thumbnails (inside messages) -- */
.chat-msg .attach-thumb {
    display: block;
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    margin-bottom: 6px;
    object-fit: cover;
}
.chat-msg .attach-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 4px;
}

/* -- Typing Indicator -- */
.chat-typing {
    align-self: flex-start;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 2px;
    padding: 12px 18px;
    display: flex;
    gap: 4px;
}
.chat-typing span {
    width: 7px;
    height: 7px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* -- Attachment Preview Bar -- */
.chat-attach-preview {
    padding: 8px 14px;
    background: #e2e8f0;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}
.chat-attach-preview.hidden { display: none; }
.attach-preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    border: 1px solid var(--border);
    max-width: 160px;
}
.attach-preview-item img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
}
.attach-preview-item .attach-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}
.attach-remove {
    cursor: pointer;
    color: var(--danger);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}

/* -- Footer (Input Bar) -- */
.chat-widget-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: white;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-widget-footer input[type="text"],
.chat-widget-footer textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    font-family: var(--font);
    background: #f8fafc;
    transition: border-color 0.2s;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    overflow-y: auto;
}
.chat-widget-footer input[type="text"]:focus,
.chat-widget-footer textarea:focus {
    border-color: var(--accent);
    background: white;
}
.chat-attach-btn, .chat-voice-btn, .chat-send-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-attach-btn, .chat-voice-btn {
    background: #f1f5f9;
    color: var(--text-secondary);
}
.chat-attach-btn:hover, .chat-voice-btn:hover { background: #e2e8f0; color: var(--accent); }

.chat-send-btn {
    background: linear-gradient(135deg, var(--accent), #0077cc);
    color: white;
}
.chat-send-btn:hover { box-shadow: 0 2px 12px rgba(0, 100, 200, 0.4); transform: scale(1.05); }

.chat-voice-btn.recording {
    background: #fee2e2;
    color: #ef4444;
    animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Mini Switch */
.switch-mini {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}
.switch-mini input { opacity: 0; width: 0; height: 0; }
.slider-mini {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 18px;
}
.slider-mini:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider-mini { background-color: var(--accent); }
input:checked + .slider-mini:before { transform: translateX(14px); }

@media (max-width: 500px) {
    .chat-widget {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    .chat-bubble { bottom: 16px; right: 16px; width: 54px; height: 54px; }
    .chat-bubble-icon { font-size: 24px; }
}

