/* ============================================================
   QUINIELA MANGOCENTER — Estilos globales
   Paleta: #3278FF accent | #152237 text | #FFFFFF bg | Inter
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&display=swap');

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

:root {
  --accent:       #3278FF;
  --accent-dark:  #1a5cd4;
  --accent-light: #EBF1FF;
  --text:         #152237;
  --text-muted:   #6B7280;
  --bg:           #FFFFFF;
  --sidebar-bg:   #F0F4FF;
  --sidebar-active:#E0EAFF;
  --border:       #E5E5E5;
  --skeleton:     #E0E0E0;
  --success:      #16A34A;
  --success-bg:   #DCFCE7;
  --error:        #DC2626;
  --error-bg:     #FEE2E2;
  --warning:      #D97706;
  --warning-bg:   #FEF3C7;
  --sidebar-w:    260px;
  --radius:       8px;
  --radius-pill:  24px;
  --shadow:       0 1px 4px rgba(0,0,0,.08), 0 2px 12px rgba(0,0,0,.05);
}

html, body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  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 .25s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img {
  max-width: 160px;
  height: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500;
  margin-bottom: 4px;
  transition: background .15s;
}
.sidebar-nav a:hover { background: var(--sidebar-active); text-decoration: none; }
.sidebar-nav a.active { background: var(--sidebar-active); color: var(--accent); font-weight: 700; }
.sidebar-nav a .nav-icon { display: flex; align-items: center; justify-content: center; width: 22px; flex-shrink: 0; }
.sidebar-nav a .nav-icon svg { display: block; }

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-menu { display: none; position: absolute; bottom: 60px; left: 12px; right: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.sidebar-user-menu.open { display: block; }
.sidebar-user-menu a { display: block; padding: 10px 14px; color: var(--text); font-size: 14px; }
.sidebar-user-menu a:hover { background: var(--sidebar-bg); }
.btn-user-toggle { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; font-size: 16px; }

/* ── Main content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 36px;
  min-height: 100vh;
}

.page-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 24px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: -18px;
  margin-bottom: 24px;
}

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-family: 'Inter', sans-serif;
  font-size: 14px; font-weight: 700;
  cursor: pointer; border: none;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--accent-light); color: var(--accent); }
.btn-secondary:hover { background: #d5e4ff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--sidebar-bg); }
.btn-danger { background: var(--error-bg); color: var(--error); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-clickable { cursor: pointer; transition: box-shadow .15s, transform .1s; }
.card-clickable:hover { box-shadow: 0 4px 16px rgba(50,120,255,.12); transform: translateY(-1px); }

/* ── Partido card ────────────────────────────────────────── */
.partido-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}
.partido-card img.sede-img {
  width: 72px; height: 72px;
  object-fit: contain;
  border-radius: var(--radius);
  flex-shrink: 0;
  background: var(--sidebar-bg);
}
.partido-info { flex: 1; min-width: 0; }
.partido-equipos {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 4px;
}
.partido-equipos .vs { color: var(--text-muted); font-weight: 400; font-size: 13px; }
.partido-meta { font-size: 13px; color: var(--text-muted); }
.partido-meta span { margin-right: 12px; }
.partido-badge {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.badge-programado { background: var(--accent-light); color: var(--accent); }
.badge-finalizado { background: var(--success-bg); color: var(--success); }
.badge-en-curso   { background: var(--warning-bg); color: var(--warning); }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 10px 18px;
  background: none; border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); font-weight: 700; border-bottom-color: var(--accent); }

/* ── Formulario ──────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--text);
  transition: border-color .15s;
  background: #fff;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(50,120,255,.12); }
.form-control:disabled { background: var(--sidebar-bg); color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--error); margin-top: 4px; }

/* Score input especial */
.score-input {
  display: flex; align-items: center; gap: 16px;
  justify-content: center; margin: 24px 0;
}
.score-input .team-name { font-weight: 700; font-size: 16px; flex: 1; text-align: center; }
.score-input .score-num {
  width: 72px; height: 72px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 32px; font-weight: 900;
  text-align: center;
  color: var(--text);
  font-family: 'Inter', sans-serif;
}
.score-input .score-num:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(50,120,255,.12); }
.score-separator { font-size: 28px; font-weight: 900; color: var(--text-muted); }

/* ── Tabla ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { font-weight: 700; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: var(--sidebar-bg); }
.rank-pos { font-weight: 900; font-size: 18px; color: var(--accent); }
.rank-1 .rank-pos { color: #F59E0B; }
.rank-2 .rank-pos { color: #9CA3AF; }
.rank-3 .rank-pos { color: #CD7C2F; }

/* ── Alerts / Empty state ────────────────────────────────── */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error   { background: var(--error-bg);   color: var(--error); }
.alert-info    { background: var(--accent-light); color: var(--accent); }

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ── Loading skeleton ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--skeleton) 25%, #f0f0f0 50%, var(--skeleton) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
  height: 20px;
  margin-bottom: 10px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 90px; margin-bottom: 12px; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  width: 32px; height: 32px;
  animation: spin .7s linear infinite;
  margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #F0F4FF 0%, #fff 60%);
  padding: 24px;
}
.login-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { max-width: 180px; }
.login-title { font-size: 22px; font-weight: 900; margin-bottom: 6px; text-align: center; }
.login-subtitle { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.login-hint { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 16px; }
.login-hint a { color: var(--text-muted); text-decoration: underline; }

/* ── Hamburguer mobile ───────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed; top: 16px; left: 16px;
  z-index: 200;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  width: 40px; height: 40px;
  font-size: 20px; cursor: pointer;
  align-items: center; justify-content: center;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 99;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-content {
    margin-left: 0;
    padding: 72px 16px 24px;
  }
  .partido-card { flex-wrap: wrap; }
  .score-input .team-name { font-size: 14px; }
  .score-input .score-num { width: 56px; height: 56px; font-size: 24px; }
  .page-title { font-size: 20px; }
}

@media (max-width: 480px) {
  .login-box { padding: 28px 20px; }
  .tabs { gap: 0; }
  .tab-btn { padding: 10px 12px; font-size: 13px; }
}

/* ── Home page ───────────────────────────────────────────── */
.home-main {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.home-video-wrapper {
  width: 100%;
  background: #000;
  line-height: 0;
}
.home-video-wrapper video {
  width: 100%;
  display: block;
  max-height: 72vh;
  object-fit: contain;
}

.home-content {
  padding: 48px 60px 40px;
  text-align: center;
  flex: 1;
}
.home-title {
  font-size: 30px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.3;
}
.home-text {
  font-size: 19px;
  color: var(--text);
  max-width: 820px;
  margin: 0 auto 36px;
  line-height: 1.6;
}
.home-ctas {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */
.home-footer {
  padding: 40px 40px 32px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--sidebar-bg);
}
.footer-links {
  display: flex;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.footer-links a {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.footer-links a:hover { color: var(--accent); text-decoration: none; }
.footer-logo {
  margin-bottom: 20px;
}
.footer-logo img { height: 52px; }
.footer-social {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}
.social-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color .15s;
}
.social-icon:hover { color: var(--accent); text-decoration: none; }
.footer-copy {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

/* Sidebar guest login btn */
.sidebar-guest {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-guest .btn {
  width: 100%;
  justify-content: center;
  font-size: 13px;
}

/* Home responsive */
@media (max-width: 768px) {
  .home-content { padding: 36px 20px 28px; }
  .home-title { font-size: 22px; }
  .home-text { font-size: 16px; }
  .home-video-wrapper video { max-height: 45vw; }
  .footer-links { gap: 16px; }
  .home-footer { padding: 28px 20px 24px; }
}
