/* ============================================================
   StreamHub – Main Stylesheet
   ============================================================ */

/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-root:     #080910;
  --bg-primary:  #0a0b14;
  --bg-secondary:#0f1020;
  --bg-card:     #131425;
  --bg-hover:    #1a1b2e;
  --bg-input:    #0d0e1f;
  --sidebar-bg:  #0d0e1f;
  --topbar-bg:   rgba(13,14,31,.9);
  --border:      #1e2040;
  --border-light:#252850;

  --accent:      #6c63ff;
  --accent-2:    #3ecfcf;
  --gradient:    linear-gradient(135deg, #6c63ff 0%, #3ecfcf 100%);
  --gradient-r:  linear-gradient(135deg, #3ecfcf 0%, #6c63ff 100%);

  --text-primary:  #f0f0ff;
  --text-secondary:#9090cc;
  --text-muted:    #55557a;

  --success: #00d4aa;
  --warning: #ffb347;
  --error:   #ff4757;
  --info:    #3ecfcf;
  --live:    #ff4757;

  --sidebar-width: 240px;
  --topbar-height:  64px;
  --radius-sm:  8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.6);
  --glow:      0 0 24px rgba(108,99,255,.25);
}

/* ── Base ──────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-root);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Layout ────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s ease;
}

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

.logo-icon {
  width: 36px; height: 36px;
  background: var(--gradient);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-beta {
  font-size: 10px;
  background: rgba(108,99,255,.2);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: .5px;
  -webkit-text-fill-color: var(--accent);
}

/* Live Status in Sidebar */
.sidebar-live-status {
  margin: 12px 14px;
  padding: 10px 14px;
  background: rgba(255,71,87,.08);
  border: 1px solid rgba(255,71,87,.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--live);
  display: none;
}
.sidebar-live-status.show { display: flex; }
.live-dot {
  width: 8px; height: 8px;
  background: var(--live);
  border-radius: 50%;
  animation: livePulse 1.5s infinite;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 16px 14px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all .2s ease;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(108,99,255,.15);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--gradient);
  border-radius: 0 3px 3px 0;
}

.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.nav-badge {
  margin-left: auto;
  background: var(--error);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .2s;
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.btn-icon {
  width: 36px; height: 36px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .2s;
  position: relative;
}
.btn-icon:hover { background: var(--border); color: var(--text-primary); }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--error);
  border-radius: 50%;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: white;
}

/* ── Page Content ──────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: all .2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 16px rgba(108,99,255,.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(108,99,255,.5);
  color: white;
}

.btn-live {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: white;
  box-shadow: 0 4px 16px rgba(255,71,87,.35);
  animation: liveGlow 3s infinite;
}
.btn-live:hover { transform: translateY(-1px); color: white; }

.btn-danger {
  background: rgba(255,71,87,.15);
  color: var(--error);
  border: 1px solid rgba(255,71,87,.3);
}
.btn-danger:hover { background: rgba(255,71,87,.25); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--radius-md); }
.btn-xl { padding: 16px 36px; font-size: 16px; border-radius: var(--radius-md); }
.btn-block { width: 100%; justify-content: center; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: var(--border-light); }
.card-glow:hover { box-shadow: var(--glow); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Stat 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-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all .3s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity .3s;
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 20px;
}
.stat-change.up   { background: rgba(0,212,170,.1); color: var(--success); }
.stat-change.down { background: rgba(255,71,87,.1);  color: var(--error); }

/* ── Grid Layouts ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 13px; color: var(--text-primary); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}
.form-control::placeholder { color: var(--text-muted); }

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

.form-control-group {
  display: flex;
  gap: 0;
}
.form-control-group .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  flex: 1;
}
.form-control-group .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  flex-shrink: 0;
}

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 40px; }
.input-icon-wrap .input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Toggles ───────────────────────────────────────────────── */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-track {
  width: 44px; height: 24px;
  background: var(--border-light);
  border-radius: 12px;
  position: relative;
  transition: background .2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .toggle-track { background: var(--gradient); }
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}
.badge-live    { background: rgba(255,71,87,.15); color: var(--live); border: 1px solid rgba(255,71,87,.3); animation: livePulse 2s infinite; }
.badge-offline { background: rgba(85,85,122,.15); color: var(--text-muted); border: 1px solid var(--border); }
.badge-success { background: rgba(0,212,170,.1); color: var(--success); }
.badge-warning { background: rgba(255,179,71,.1); color: var(--warning); }
.badge-error   { background: rgba(255,71,87,.1);  color: var(--error);   }
.badge-info    { background: rgba(62,207,207,.1);  color: var(--info);   }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.02); }

/* ── Platform Cards ────────────────────────────────────────── */
.platform-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all .3s;
  position: relative;
  overflow: hidden;
}
.platform-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--platform-color, var(--gradient));
  opacity: .4;
  transition: opacity .3s;
}
.platform-card:hover::after { opacity: 1; }
.platform-card:hover { transform: translateY(-3px); border-color: var(--border-light); box-shadow: var(--shadow); }

.platform-header { display: flex; align-items: center; gap: 12px; }
.platform-icon-wrap {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
}
.platform-name { font-weight: 700; font-size: 15px; }
.platform-status { margin-left: auto; }

.platform-info { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.platform-info span { display: flex; align-items: center; gap: 6px; }

.platform-actions { display: flex; gap: 8px; margin-top: auto; }

/* ── Stream Key Box ────────────────────────────────────────── */
.stream-key-box {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.stream-key-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent-2); }
.stream-key-masked { letter-spacing: 2px; color: var(--text-muted); }
.copy-btn {
  flex-shrink: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: all .2s;
}
.copy-btn:hover { background: rgba(108,99,255,.2); color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { background: rgba(0,212,170,.15); color: var(--success); border-color: var(--success); }

/* ── Go Live Panel ─────────────────────────────────────────── */
.golive-panel {
  background: linear-gradient(135deg, rgba(255,71,87,.05) 0%, rgba(255,107,129,.03) 100%);
  border: 1px solid rgba(255,71,87,.2);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
}
.golive-btn-wrap {
  position: relative;
  display: inline-block;
}
.golive-btn-wrap::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: rgba(255,71,87,.1);
  animation: livePulse 2s infinite;
}
.golive-big-btn {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  position: relative;
  transition: all .3s;
  box-shadow: 0 8px 32px rgba(255,71,87,.4);
}
.golive-big-btn:hover { transform: scale(1.05); box-shadow: 0 12px 40px rgba(255,71,87,.6); }
.golive-big-btn.live { background: linear-gradient(135deg, #00d4aa, #00b899); box-shadow: 0 8px 32px rgba(0,212,170,.4); }

/* ── Chat ──────────────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height) - 120px);
  min-height: 400px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background .2s;
  animation: msgSlide .2s ease;
}
.chat-msg:hover { background: var(--bg-hover); }
.chat-msg.highlighted { background: rgba(255,179,71,.06); border-left: 3px solid var(--warning); }
.chat-msg.pinned { background: rgba(108,99,255,.08); border-left: 3px solid var(--accent); }

.msg-platform-icon {
  width: 20px; height: 20px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  color: white;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg-username { font-weight: 700; font-size: 13px; }
.msg-text { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.msg-time { font-size: 11px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }

.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

/* ── Analytics Charts ──────────────────────────────────────── */
.chart-card { padding: 20px; }
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.chart-wrap { position: relative; height: 240px; }

/* ── Platform Filter Tabs ──────────────────────────────────── */
.platform-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.platform-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all .2s;
}
.platform-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.platform-tab.active { background: var(--bg-hover); color: var(--text-primary); }

/* ── Stream Health ─────────────────────────────────────────── */
.health-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.health-item {
  background: var(--bg-card);
  padding: 16px;
  text-align: center;
}
.health-value { font-size: 22px; font-weight: 800; }
.health-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }

/* ── Destination Status Grid ───────────────────────────────── */
.dest-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.dest-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .3s;
}
.dest-status-card.live { border-color: rgba(255,71,87,.3); background: rgba(255,71,87,.04); }
.dest-status-card.error { border-color: rgba(255,71,87,.4); }
.dest-indicator {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.dest-indicator.live    { background: var(--live); animation: livePulse 1.5s infinite; }
.dest-indicator.error   { background: var(--error); }
.dest-indicator.success { background: var(--success); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.97);
  transition: transform .25s;
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 0;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  background: var(--bg-hover);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Notifications Dropdown ────────────────────────────────── */
.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
}
.dropdown-menu.show { display: block; }
.dropdown-header { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13px; }
.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .2s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.unread { background: rgba(108,99,255,.04); }

/* ── Schedule ──────────────────────────────────────────────── */
.schedule-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.schedule-item:last-child { border-bottom: none; }
.schedule-time {
  text-align: center;
  min-width: 60px;
}
.schedule-time .date { font-size: 11px; color: var(--text-muted); }
.schedule-time .time { font-size: 16px; font-weight: 800; }
.schedule-info { flex: 1; }
.schedule-title { font-weight: 600; }
.schedule-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Alerts / Toasts ───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease;
  border: 1px solid transparent;
}
.toast.toast-success { background: rgba(0,212,170,.1); border-color: rgba(0,212,170,.3); color: var(--success); }
.toast.toast-error   { background: rgba(255,71,87,.1);  border-color: rgba(255,71,87,.3);  color: var(--error); }
.toast.toast-info    { background: rgba(62,207,207,.1); border-color: rgba(62,207,207,.3); color: var(--info); }
.toast.toast-warning { background: rgba(255,179,71,.1); border-color: rgba(255,179,71,.3); color: var(--warning); }
.toast i { font-size: 16px; flex-shrink: 0; }
.toast-msg { flex: 1; font-size: 13px; font-weight: 500; }

/* ── Empty States ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; max-width: 320px; margin: 0 auto 20px; }

/* ── Loading Spinner ───────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-root);
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 20% 20%, rgba(108,99,255,.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(62,207,207,.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 60% 30%, rgba(255,71,87,.05) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 56px; height: 56px;
  background: var(--gradient);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: white;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(108,99,255,.4);
}
.login-logo h1 {
  font-size: 24px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.login-error {
  background: rgba(255,71,87,.1);
  border: 1px solid rgba(255,71,87,.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--error);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
@keyframes liveGlow {
  0%, 100% { box-shadow: 0 4px 16px rgba(255,71,87,.35); }
  50% { box-shadow: 0 4px 24px rgba(255,71,87,.6); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes msgSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn .4s ease; }
.slide-up { animation: slideUp .4s ease; }

/* ── Progress Bars ─────────────────────────────────────────── */
.progress-bar {
  background: var(--bg-hover);
  border-radius: 20px;
  height: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 20px;
  transition: width .5s ease;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}

/* ── Misc ──────────────────────────────────────────────────── */
.text-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.w-full { width: 100%; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded { border-radius: var(--radius-sm); }
