/* ============================================================
   auth.css — Login page & Admin panel styling
   ============================================================ */

:root {
    --bg-base:       #0a0e1a;
    --bg-card:       #111827;
    --bg-card2:      #1a2236;
    --border:        #2a3c5c;
    --text-primary:  #f1f5f9;
    --text-secondary:#a8b6cc;
    --text-muted:    #768396;
    --accent:        #00d4ff;
    --ok:            #06d6a0;
    --ok-dim:        rgba(6,214,160,0.12);
    --warning:       #ffd93d;
    --warning-dim:   rgba(255,217,61,0.12);
    --critical:      #ff4757;
    --critical-dim:  rgba(255,71,87,0.15);
    --scope-ecg:     #39ff6a;
    --font-ui:       'Inter', system-ui, sans-serif;
    --font-mono:     'JetBrains Mono', monospace;
    --radius:        8px;
    --radius-lg:     12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { font-family: var(--font-ui); background: var(--bg-base); color: var(--text-primary); min-height: 100vh; font-size: 14px; }

/* ── Login Page ──────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--scope-ecg);
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.pulse-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--scope-ecg);
    box-shadow: 0 0 8px var(--scope-ecg);
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 28px;
}

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

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

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

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 14px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
    font-family: var(--font-ui);
}
.btn-login:hover { opacity: 0.85; }

.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error   { background: var(--critical-dim); border: 1px solid var(--critical); color: var(--critical); }
.alert-success { background: var(--ok-dim);       border: 1px solid var(--ok);       color: var(--ok); }
.alert-warning { background: var(--warning-dim);  border: 1px solid var(--warning);  color: var(--warning); }

.login-footer {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 24px;
}

/* ── Admin Layout ────────────────────────────────────────── */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: #0d1423;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--scope-ecg);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover { background: var(--bg-card2); color: var(--text-primary); }
.nav-item.active { background: var(--bg-card2); color: var(--accent); border-left-color: var(--accent); }
.nav-item .icon { width: 16px; text-align: center; font-size: 14px; }

.sidebar-bottom {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px; color: #000;
    flex-shrink: 0;
}

.user-name { font-size: 12px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--text-muted); }

.btn-logout {
    display: block;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--critical); color: var(--critical); }

.admin-content {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.admin-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: #0d1423;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title { font-size: 18px; font-weight: 700; }
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.admin-body { padding: 24px 28px; flex: 1; }

/* ── Cards & Stats ───────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

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

.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 700; }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Table ───────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.card-title { font-size: 14px; font-weight: 700; }

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-ok       { background: var(--ok-dim);       color: var(--ok);       }
.badge-error    { background: var(--critical-dim);  color: var(--critical); }
.badge-warning  { background: var(--warning-dim);   color: var(--warning);  }
.badge-muted    { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.badge-accent   { background: rgba(0,212,255,0.12); color: var(--accent);   }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.15s;
    font-family: var(--font-ui);
}
.btn-primary  { background: var(--accent);    color: #000; border-color: var(--accent); }
.btn-danger   { background: var(--critical-dim); color: var(--critical); border-color: var(--critical); }
.btn-ghost    { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn:hover    { opacity: 0.85; }
.btn-sm       { padding: 4px 10px; font-size: 11px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(16px);
    transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 18px; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body   { padding: 20px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Progress bar (server stats) ────────────────────────── */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.progress-fill.ok      { background: var(--ok); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--critical); }

/* ── Beds list page ──────────────────────────────────────── */
.beds-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

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

.beds-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bed-list { display: flex; flex-direction: column; gap: 12px; }

.bed-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
}
.bed-row:hover { border-color: var(--accent); background: var(--bg-card2); }
.bed-row.offline { opacity: 0.55; }

.bed-number {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--scope-ecg);
    min-width: 48px;
    text-align: center;
}

.bed-info { flex: 1; }
.bed-patient { font-size: 15px; font-weight: 600; }
.bed-room    { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.bed-vitals-preview {
    display: flex;
    gap: 16px;
    align-items: center;
}

.vital-preview {
    text-align: center;
    min-width: 48px;
}

.vital-preview-val {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.vital-preview-lbl {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.bed-status { min-width: 80px; text-align: right; }

/* ── Topbar (beds & dashboard pages) ────────────────────── */
.topbar {
    background: #0d1423;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-brand {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--scope-ecg);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .admin-content { margin-left: 0; }
    .bed-vitals-preview { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
