/* ═══════════════════════════════════════════════════
   Adivínate Esta — main.css
   Global variables, reset & base layout
   ═══════════════════════════════════════════════════ */

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

/* ── CSS Custom Properties ─────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:        #080818;
  --bg-card:        #0D0D24;
  --bg-surface:     #12122E;
  --bg-elevated:    #1A1A3E;

  /* Borders */
  --border-subtle:  #1E1E4A;
  --border-default: #2D2D6B;
  --border-accent:  #4A4A9A;

  /* Primary colors */
  --purple:         #7C3AED;
  --purple-light:   #9D5DF0;
  --purple-glow:    rgba(124, 58, 237, 0.4);
  --cyan:           #06B6D4;
  --cyan-light:     #22D3EE;
  --cyan-glow:      rgba(6, 182, 212, 0.35);

  /* Answer states */
  --correct:        #10B981;
  --correct-bg:     rgba(16, 185, 129, 0.15);
  --correct-glow:   rgba(16, 185, 129, 0.4);
  --wrong:          #EF4444;
  --wrong-bg:       rgba(239, 68, 68, 0.15);
  --wrong-glow:     rgba(239, 68, 68, 0.4);

  /* Text */
  --text-primary:   #F1F0FF;
  --text-secondary: #A8A8C8;
  --text-muted:     #5A5A8A;

  /* Typography */
  --font-display:   'Rajdhani', sans-serif;
  --font-body:      'Inter', sans-serif;

  /* Spacing & Shape */
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      20px;

  /* Transitions */
  --transition:     0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  display: block;
}

a {
  color: var(--cyan-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--cyan);
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font-body);
}

/* ── Layout Base ────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

.container--narrow {
  max-width: 720px;
}

/* ── Typography ─────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }

p {
  color: var(--text-secondary);
}

/* ── Card Component ─────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4),
              0 0 0 1px var(--border-subtle);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
              0 0 20px var(--purple-glow);
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  box-shadow: 0 0 20px var(--purple-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--purple-light);
  border-color: var(--purple-light);
  box-shadow: 0 0 32px var(--purple-glow);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--cyan-light);
  box-shadow: 0 0 16px var(--cyan-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: var(--wrong);
  border-color: var(--wrong);
}

.btn-danger:hover:not(:disabled) {
  background: var(--wrong-bg);
  box-shadow: 0 0 16px var(--wrong-glow);
}

/* ── Badge Component ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge--purple {
  background: rgba(124, 58, 237, 0.2);
  color: var(--purple-light);
  border: 1px solid rgba(124, 58, 237, 0.4);
}

.badge--cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge--correct {
  background: var(--correct-bg);
  color: var(--correct);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge--wrong {
  background: var(--wrong-bg);
  color: var(--wrong);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge--gold   { background: rgba(255, 215, 0, 0.15);  color: #FFD700; border: 1px solid rgba(255,215,0,0.3); }
.badge--silver { background: rgba(192, 192, 192, 0.15); color: #C0C0C0; border: 1px solid rgba(192,192,192,0.3); }
.badge--bronze { background: rgba(205, 127, 50, 0.15);  color: #CD7F32; border: 1px solid rgba(205,127,50,0.3); }

/* ── Difficulty badges ──────────────────────────────── */
.badge--easy   { background: rgba(16, 185, 129, 0.15); color: var(--correct);  border: 1px solid rgba(16, 185, 129, 0.3); }
.badge--medium { background: rgba(245, 158, 11, 0.15); color: #F59E0B;          border: 1px solid rgba(245,158,11,0.3); }
.badge--hard   { background: var(--wrong-bg);           color: var(--wrong);    border: 1px solid rgba(239,68,68,0.3); }

/* ── Glow Utilities ─────────────────────────────────── */
.glow-purple {
  box-shadow: 0 0 20px var(--purple-glow), 0 0 40px rgba(124, 58, 237, 0.2);
}

.glow-cyan {
  box-shadow: 0 0 20px var(--cyan-glow), 0 0 40px rgba(6, 182, 212, 0.15);
}

/* ── Form Controls ──────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-glow);
}

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

.form-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235A5A8A'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

/* ── Alert / Status ─────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.alert--error {
  background: var(--wrong-bg);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
}

.alert--success {
  background: var(--correct-bg);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6EE7B7;
}

/* ── Utility ────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-cyan    { color: var(--cyan-light); }
.text-purple  { color: var(--purple-light); }
.text-correct { color: var(--correct); }
.text-wrong   { color: var(--wrong); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-flex     { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: 8px; }
.gap-2  { gap: 16px; }
.gap-3  { gap: 24px; }
.w-full { width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ── Divider ────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 24px 0;
}

/* ── Responsive helpers ─────────────────────────────── */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ═══════════════════════════════════════════════════
   SITE NAVIGATION
   ═══════════════════════════════════════════════════ */
:root {
  --nav-height: 56px;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(8, 8, 24, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-icon { font-size: 1.2rem; }
.nav-logo-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  background: linear-gradient(130deg, var(--purple-light), var(--cyan-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

/* Center links */
.nav-links {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
}
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}
.nav-link.active {
  color: var(--purple-light);
  background: rgba(124, 58, 237, 0.15);
}

/* Auth buttons */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-anon-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  white-space: nowrap;
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-btn--ghost {
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.nav-btn--ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: var(--bg-surface);
}
.nav-btn--primary {
  background: var(--purple);
  color: #fff;
  border: 1px solid var(--purple);
  box-shadow: 0 0 12px var(--purple-glow);
}
.nav-btn--primary:hover {
  background: var(--purple-light);
  border-color: var(--purple-light);
}

/* User dropdown */
.nav-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
  -webkit-user-select: none;
}
.nav-user:hover {
  border-color: var(--border-default);
  background: var(--bg-surface);
}
.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}
.nav-username {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.nav-user.open .nav-chevron { transform: rotate(180deg); }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1001;
}
.nav-user.open .nav-dropdown { display: block; }
.nav-dropdown-item {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.nav-dropdown-item:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.nav-dropdown-item--danger { color: var(--wrong); }
.nav-dropdown-item--danger:hover { background: var(--wrong-bg); color: var(--wrong); }
.nav-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
}
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all 0.25s ease;
  pointer-events: none;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile slide-down panel */
.nav-mobile-panel {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}
.nav-mobile-panel.open { display: flex; }
.nav-mobile-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.nav-mobile-link:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.nav-mobile-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}
.nav-mobile-auth {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}
.nav-mobile-auth .nav-btn { flex: 1; justify-content: center; }

/* Game nav (reduced) */
.site-nav--game .nav-links,
.site-nav--game .nav-auth,
.site-nav--game .nav-hamburger { display: none !important; }

.nav-abandon-btn {
  margin-left: auto;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.nav-abandon-btn:hover {
  border-color: var(--wrong);
  color: var(--wrong);
  background: var(--wrong-bg);
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .nav-username { display: none; }
  .nav-chevron { display: none; }
}

/* ═══════════════════════════════════════════════════
   SITE FOOTER
   ═══════════════════════════════════════════════════ */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  padding: 48px 0 0;
  margin-top: 64px;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 36px;
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.footer-tagline {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-col-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.footer-links-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-links-list a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-links-list a:hover { color: var(--cyan-light); }

.footer-heart-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.footer-heart { color: #EF4444; }

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding: 16px 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .site-footer { margin-top: 40px; padding: 32px 0 0; }
}
