/* ============================================================
   STLive - Sistema de Clases en Vivo - Estilos Principales
   ST System © 2024
   ============================================================ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --dark: #0f172a;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #6366f1;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.07);
  --sidebar-w: 260px;
  --topbar-h: 64px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  flex-shrink: 0;
}

.brand-name { color: #fff; font-weight: 800; font-size: 18px; display: block; }
.brand-sub  { color: var(--sidebar-text); font-size: 11px; display: block; }

.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  flex-shrink: 0; overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name  { color: #fff; font-size: 13px; font-weight: 600; }
.user-role  { color: var(--sidebar-text); font-size: 11px; }

.sidebar-menu {
  list-style: none;
  padding: 12px 0 24px;
  flex: 1;
}

.menu-label {
  color: rgba(148,163,184,.5);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 16px 20px 4px;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  margin: 2px 10px;
  transition: all .2s;
}
.sidebar-menu li a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-menu li a.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
}
.sidebar-menu li a i { width: 20px; text-align: center; font-size: 15px; }

/* ---- MAIN WRAPPER ---- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: margin .3s ease;
}

/* ---- TOPBAR ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.05);
}

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 20px;
  padding: 8px; border-radius: 8px;
  transition: .2s;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

.topbar-title {
  font-weight: 700; font-size: 17px; flex: 1;
  color: var(--text);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px;
  padding: 8px; border-radius: 10px;
  position: relative;
  transition: .2s;
}
.icon-btn:hover { background: var(--bg); color: var(--primary); }
.icon-btn .badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border-radius: 30px;
  font-size: 13px; font-weight: 600;
  color: var(--text);
}
.chip-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.chip-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- PAGE CONTENT ---- */
.page-content { padding: 28px; flex: 1; }

/* ---- FLASH ---- */
.flash {
  margin: 0; padding: 14px 24px;
  display: flex; align-items: center; gap: 12px;
  font-weight: 500; font-size: 14px;
  border-left: 4px solid transparent;
  position: relative;
}
.flash-success { background: #d1fae5; border-color: var(--success); color: #065f46; }
.flash-danger  { background: #fee2e2; border-color: var(--danger);  color: #991b1b; }
.flash-warning { background: #fef3c7; border-color: var(--warning); color: #92400e; }
.flash-info    { background: #e0f2fe; border-color: var(--info);    color: #075985; }
.flash-close   { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: .6; }

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-body  { padding: 24px; }

/* ---- STAT CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px;
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; flex-shrink: 0;
}
.stat-icon.purple { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.stat-icon.blue   { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.stat-icon.green  { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.stat-icon.pink   { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.stat-val  { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-lbl  { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--bg); color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; text-align: left; }
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 { background: #f8fafc; }

/* ---- BADGES ---- */
.badge-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 30px;
  font-size: 12px; font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #e0f2fe; color: #075985; }
.badge-primary { background: #ede9fe; color: #5b21b6; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(99,102,241,.4); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border .2s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); flex: 1; }
.input-group-btn { border: 1.5px solid var(--border); border-left: none; padding: 0 14px; background: var(--bg); cursor: pointer; color: var(--text-muted); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---- MODAL ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 90%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-weight: 700; font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- DROPDOWN ---- */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.12);
  min-width: 280px; z-index: 500;
}
.dropdown-menu.show { display: block; }
.dropdown-header { padding: 12px 16px; font-size: 12px; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .04em; }
.dropdown-footer { padding: 10px 16px; border-top: 1px solid var(--border); text-align: center; }
.dropdown-footer a { font-size: 13px; color: var(--primary); font-weight: 600; text-decoration: none; }

.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; text-decoration: none; color: var(--text);
  transition: background .2s; border-bottom: 1px solid var(--border);
}
.notif-item:hover { background: var(--bg); }
.notif-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.notif-info    { background: #e0f2fe; color: #0284c7; }
.notif-pago    { background: #d1fae5; color: #059669; }
.notif-clase   { background: #ede9fe; color: #7c3aed; }
.notif-contrato{ background: #fef3c7; color: #d97706; }
.notif-advertencia { background: #fee2e2; color: #dc2626; }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---- CALENDAR ---- */
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-day-head { font-size: 12px; font-weight: 700; text-align: center; color: var(--text-muted); padding: 8px 0; }
.cal-day {
  min-height: 80px; padding: 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 12px; background: #fff;
  cursor: pointer; transition: .2s;
}
.cal-day:hover { border-color: var(--primary); }
.cal-day.today { border-color: var(--primary); background: #ede9fe; }
.cal-day.other-month { opacity: .4; }
.cal-day-num { font-weight: 700; margin-bottom: 4px; }
.cal-event { background: var(--primary); color: #fff; border-radius: 4px; padding: 2px 5px; margin-top: 2px; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- LIVE ROOM ---- */
.live-room { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; }
.live-room iframe { width: 100%; height: 70vh; border: none; display: block; }
.live-bar { background: #0f172a; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live-status { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 14px; font-weight: 600; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.3)} }

/* ---- PAGE HEADER ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 12px; flex-wrap: wrap; }
.page-header h2 { font-size: 22px; font-weight: 800; color: var(--text); }
.page-header p  { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* ---- SECTION GRID ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }

/* ---- MISC ---- */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 12px; }
.gap-1 { gap: 6px; }
.w-100 { width: 100%; }

/* ---- LOGIN PAGE ---- */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { background: #fff; border-radius: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.3); padding: 48px; width: 100%; max-width: 440px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon { width: 70px; height: 70px; border-radius: 20px; background: linear-gradient(135deg, #6366f1, #0ea5e9); display: flex; align-items: center; justify-content: center; font-size: 32px; color: #fff; margin: 0 auto 16px; }
.login-logo h1 { font-size: 28px; font-weight: 800; color: #0f172a; }
.login-logo p  { color: #64748b; font-size: 14px; }
.login-box .form-control { background: #f8fafc; }

/* ---- CERTIFICATE ---- */
.certificate-preview { border: 8px solid var(--primary); border-radius: 20px; padding: 48px; text-align: center; background: linear-gradient(135deg,#fefce8,#fff); position: relative; }
.certificate-preview::before { content:''; position:absolute; inset:4px; border:2px dashed var(--primary-light); border-radius:14px; pointer-events:none; }
.cert-title { font-size: 36px; font-weight: 900; color: var(--primary); }
.cert-name  { font-size: 28px; font-weight: 800; color: var(--dark); margin: 12px 0; }
.cert-code  { font-size: 13px; color: var(--text-muted); margin-top: 16px; }

/* Responsive */
@media (max-width:900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .grid-2,.grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width:540px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .login-box { padding: 32px 24px; }
}

/* ---- FINANCE ---- */
.fin-ingreso td:first-child { border-left: 3px solid var(--success); }
.fin-egreso  td:first-child { border-left: 3px solid var(--danger); }
.amount-positive { color: var(--success); font-weight: 700; }
.amount-negative { color: var(--danger); font-weight: 700; }
.progress-bar-wrap { background: var(--bg); border-radius: 30px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 30px; background: linear-gradient(90deg, var(--primary), var(--secondary)); }
