/* ═══════════════════════════════════════════════════════════════
   ZONA GEMELOS 🎭 — Admin Panel v2
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #08080f;
  --bg2: #0d0d14;
  --bg3: #12121e;
  --surface: rgba(255,255,255,0.03);
  --surface2: rgba(255,255,255,0.05);
  --accent: #8a5eff;
  --accent-light: #a78bfa;
  --green: #22cc88;
  --red: #ff5555;
  --yellow: #f5a623;
  --text: #efeff1;
  --text2: #adadb8;
  --text3: #5a5a66;
  --border: rgba(255,255,255,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 240px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── LOGIN SCREEN ─── */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#login-screen.hidden { display: none; }

#login-box {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 28px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 20px;
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

#login-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(138,94,255,0.3), rgba(107,63,204,0.2));
  border: 0.5px solid rgba(138,94,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
#login-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
#login-sub {
  font-size: 13px;
  color: var(--text3);
  text-align: center;
}

.login-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}
.login-input:focus {
  border-color: rgba(138,94,255,0.3);
}
.login-input::placeholder { color: var(--text3); }

#login-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #6b3fcc);
  border: none;
  border-radius: 12px;
  padding: 14px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
#login-btn:active { transform: scale(0.97); }
#login-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#login-error {
  color: var(--red);
  font-size: 13px;
  text-align: center;
}

/* ─── MAIN APP ─── */
#app { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 0.5px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 16px;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 900;
  border-bottom: 0.5px solid var(--border);
}
.sidebar-brand span:first-child { font-size: 24px; }
.sidebar-title { letter-spacing: -0.3px; }
.sidebar-badge {
  font-size: 7px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: rgba(138,94,255,0.08); color: var(--accent-light); }
.nav-btn .nav-icon { font-size: 16px; width: 20px; text-align: center; }

#logout-side {
  margin-top: auto;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
}
#logout-btn {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
  width: 100%;
}
#logout-btn:hover { color: var(--red); background: rgba(255,85,85,0.06); }

/* ─── MAIN ─── */
#main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: 100vh;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.main-header h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.3px;
}

.section {
  display: none;
}
.section.active {
  display: block;
}

/* ─── STATS GRID ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 0.5px solid var(--border);
  text-align: center;
  transition: all 0.2s;
}
.stat-card:hover {
  border-color: rgba(138,94,255,0.12);
  background: rgba(138,94,255,0.02);
}
.stat-value {
  font-size: 30px;
  font-weight: 900;
  color: var(--accent-light);
  font-family: inherit;
}
.stat-label {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stat-card.online .stat-value {
  color: var(--green);
}
.stat-card .stat-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
}

/* ─── CARDS ─── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 0.5px solid var(--border);
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── FORM ELEMENTS ─── */
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
}
.form-input:focus {
  border-color: rgba(138,94,255,0.3);
}
.form-input::placeholder { color: var(--text3); }
textarea.form-input {
  min-height: 80px;
  resize: vertical;
}
select.form-input {
  appearance: auto;
}

/* ─── BUTTONS ─── */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-outline {
  background: transparent;
  border: 0.5px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover { border-color: rgba(138,94,255,0.2); color: var(--text); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ─── STREAM STATUS ─── */
.stream-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.stream-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.stream-dot.running { background: var(--green); box-shadow: 0 0 8px rgba(34,204,136,0.3); }
.stream-dot.stopped { background: var(--red); box-shadow: 0 0 8px rgba(255,85,85,0.3); }
.stream-dot.no_script { background: var(--text3); }
.stream-label {
  font-size: 14px;
  color: var(--text2);
}
.stream-url {
  font-size: 12px;
  color: var(--text3);
  word-break: break-all;
  padding: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  margin-bottom: 12px;
}

/* ─── TABLES / LISTS ─── */
.list-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.list-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  gap: 12px;
  background: rgba(255,255,255,0.02);
  border: 0.5px solid transparent;
  font-size: 13px;
}
.list-row:hover { background: rgba(255,255,255,0.04); border-color: var(--border); }
.list-row .row-main { flex: 1; }
.list-row .row-sub { color: var(--text3); font-size: 12px; }
.list-row .row-actions { display: flex; gap: 4px; flex-shrink: 0; }

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-green { background: rgba(34,204,136,0.08); color: var(--green); border: 0.5px solid rgba(34,204,136,0.15); }
.badge-gray { background: rgba(255,255,255,0.04); color: var(--text3); border: 0.5px solid var(--border); }
.badge-red { background: rgba(255,85,85,0.08); color: var(--red); border: 0.5px solid rgba(255,85,85,0.15); }

/* ─── EMPTY STATE ─── */
.empty-state {
  padding: 30px 20px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

/* ─── TOAST ─── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
#toast.show {
  transform: translateY(0);
  opacity: 1;
}
#toast.success { background: rgba(34,204,136,0.9); backdrop-filter: blur(12px); }
#toast.error { background: rgba(255,85,85,0.9); backdrop-filter: blur(12px); }
#toast.info { background: rgba(138,94,255,0.9); backdrop-filter: blur(12px); }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(4,4,12,0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  animation: fadeUp 0.2s ease;
}
.modal-box h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  #sidebar {
    width: 56px;
    padding: 8px;
    overflow: hidden;
  }
  #sidebar .sidebar-title,
  #sidebar .sidebar-badge,
  #sidebar .nav-btn .nav-text,
  #sidebar #logout-btn {
    display: none;
  }
  #sidebar .sidebar-brand span:first-child { font-size: 28px; }
  #sidebar .nav-btn { justify-content: center; padding: 10px; }
  #sidebar .nav-btn .nav-icon { font-size: 18px; margin: 0; }
  
  #main { margin-left: 56px; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 24px; }
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(138,94,255,0.15); border-radius: 4px; }
