/* Viraklip — estilos base (referencia visual provisional: tema oscuro morado) */
:root {
  --bg: #0d0717;
  --surface: #1c1828;
  --surface-2: #26213a;
  --sidebar: linear-gradient(180deg, #3b1aa3 0%, #2a1380 100%);
  --sidebar-item: rgba(255, 255, 255, 0.08);
  --accent: #7b2ff7;
  --accent-hover: #8d47ff;
  --text: #f4f1fb;
  --text-muted: #a49cbc;
  --live: #e5322d;
  --info: #1f6fe0;
  --radius: 12px;
  --radius-sm: 8px;
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 26px; letter-spacing: -0.02em; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }

/* ---------- Página de ingreso ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(123, 47, 247, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(59, 26, 163, 0.45), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; padding: 40px 32px; border-radius: 20px;
  background: rgba(28, 24, 40, 0.85); border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); text-align: center;
}
.auth-role {
  display: inline-block; margin: 28px 0 8px; padding: 4px 12px; border-radius: 999px;
  background: rgba(123, 47, 247, 0.2); color: #c7a8ff; font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.auth-card h1 { margin: 8px 0 8px; font-size: 26px; }
.auth-card p.lead { margin: 0 0 28px; color: var(--text-muted); line-height: 1.5; }
.btn-google {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: #fff; color: #1f1f1f; font-weight: 700; font-size: 15px;
  transition: transform 0.08s ease, box-shadow 0.2s ease;
}
.btn-google:hover { box-shadow: 0 0 0 4px rgba(123, 47, 247, 0.35); }
.btn-google:active { transform: translateY(1px); }
.btn-google:disabled { opacity: 0.6; cursor: progress; }
.btn-google svg { width: 20px; height: 20px; }
.auth-error { margin: 16px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(229, 50, 45, 0.15); color: #ff9a96; font-size: 14px; }
.auth-switch { margin-top: 28px; font-size: 14px; color: var(--text-muted); }
.auth-switch a { color: #c7a8ff; font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-legal { margin-top: 16px; font-size: 12px; color: var(--text-muted); opacity: 0.7; }

/* ---------- Layout de dashboard ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); padding: 28px 20px; display: flex; flex-direction: column; gap: 8px; }
.sidebar .brand { margin: 0 8px 28px; }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--sidebar-item); color: rgba(255, 255, 255, 0.75); text-decoration: none; font-size: 15px;
}
.nav-item svg { width: 22px; height: 22px; flex: none; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 700; }
.nav-item:not(.active):hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, 0.15); margin: 12px 0; }
.nav-role { margin-top: auto; padding: 12px 14px; font-size: 12px; color: rgba(255, 255, 255, 0.55); text-transform: uppercase; letter-spacing: 0.08em; }

.main { padding: 20px 32px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.search { flex: 1; display: flex; align-items: center; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 14px 16px; color: var(--text); font: inherit; outline: none; }
.search input::placeholder { color: var(--text-muted); opacity: 0.7; }
.search button { display: flex; align-items: center; gap: 8px; border: 0; background: var(--surface-2); padding: 14px 20px; cursor: pointer; color: var(--text-muted); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 24px; height: 24px; }

.avatar-wrap { position: relative; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; overflow: hidden;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; display: grid; place-items: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu {
  position: absolute; right: 0; top: calc(100% + 14px); width: 320px; z-index: 20;
  background: #3a1a9e; border-radius: 16px; padding: 24px 16px 16px; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
.menu::before { content: ""; position: absolute; right: 14px; top: -8px; border: 8px solid transparent; border-top: 0; border-bottom-color: #3a1a9e; }
.menu-head { text-align: center; margin-bottom: 18px; }
.menu-head .avatar { width: 72px; height: 72px; font-size: 26px; margin: 0 auto 12px; cursor: default; }
.menu-head strong { display: block; font-size: 18px; }
.menu-head span { font-size: 13px; color: rgba(255, 255, 255, 0.65); word-break: break-all; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-top: 8px;
  border: 0; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.08); cursor: pointer; text-align: left; font-size: 15px;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.16); }
.menu-item svg { width: 22px; height: 22px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 16px; }
.section-title h2 { margin: 0; font-size: 22px; }
.section-title a { font-size: 14px; color: var(--text-muted); text-decoration: none; }
.welcome { margin-bottom: 32px; }
.welcome h1 { margin: 0 0 6px; font-size: 28px; }
.welcome p { margin: 0; color: var(--text-muted); }

.grid-watch { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 20px; height: 420px; margin-bottom: 40px; }
.grid-watch > :first-child { grid-row: span 2; }
.grid-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.skeleton { background: var(--surface); border-radius: var(--radius); min-height: 160px; position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--text-muted); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; padding: 16px; }
  .sidebar .brand { margin: 0 auto 0 0; }
  .nav-item span, .nav-sep, .nav-role { display: none; }
  .main { padding: 16px; }
  .search button span { display: none; }
  .grid-watch { grid-template-columns: 1fr 1fr; grid-template-rows: auto; height: auto; }
  .grid-watch > :first-child { grid-column: span 2; grid-row: auto; min-height: 220px; }
  .grid-row { grid-template-columns: repeat(2, 1fr); }
  .menu { width: min(320px, calc(100vw - 32px)); }
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 14px; text-decoration: none;
}
.btn:hover { background: #312a4a; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid rgba(255, 255, 255, 0.12); }
.btn-ghost:hover { background: rgba(229, 50, 45, 0.15); border-color: rgba(229, 50, 45, 0.5); color: #ff9a96; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; vertical-align: middle;
  background: rgba(123, 47, 247, 0.25); color: #c7a8ff; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}

/* ---------- Plataformas conectadas ---------- */
.connections { margin-bottom: 40px; }
.platforms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.platform { background: var(--surface); border-radius: var(--radius); padding: 20px; }
.platform.is-soon { opacity: 0.6; }
.platform-head { display: flex; align-items: center; gap: 14px; }
.platform-icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 10px; color: #fff; }
.platform-icon svg { width: 26px; height: 26px; }
.platform-icon--twitch { background: #9146ff; }
.platform-icon--youtube { background: #ff0033; }
.platform-icon--kick { background: #53fc18; color: #0b0b0b; }
.platform-title { flex: 1; min-width: 0; }
.platform-title h3 { margin: 0 0 2px; font-size: 17px; }
.platform-title span { font-size: 13px; color: var(--text-muted); }
.platform-accounts { list-style: none; margin: 0; padding: 0; }
.platform-accounts:not(:empty) { margin-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.platform-account { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.platform-account:last-child { border-bottom: 0; padding-bottom: 0; }
.platform-account-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 800;
}
.platform-account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.platform-account-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.platform-account-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-account-info a { font-size: 13px; color: var(--text-muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-account-info a:hover { color: #c7a8ff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  max-width: min(480px, calc(100vw - 32px)); padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  border-left: 4px solid var(--accent); font-size: 14px;
}
.toast[data-kind="success"] { border-left-color: #22c55e; }
.toast[data-kind="error"] { border-left-color: var(--live); }

@media (max-width: 1100px) {
  .platforms { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .platform-head { flex-wrap: wrap; }
  .platform-head .btn { width: 100%; }
}

.platform-error { margin: 16px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(229, 50, 45, 0.12); color: #ff9a96; font-size: 13px; }
.link-btn { border: 0; background: none; padding: 0; margin-left: 4px; color: #fff; font-weight: 700; text-decoration: underline; cursor: pointer; }
