/* utilidades.ar - Estilos principales */

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

:root {
  --bg: #f5f3ff;
  --surface: #ffffff;
  --surface-hover: #faf8ff;
  --border: #e4e0f0;
  --text: #1e1b2e;
  --text-muted: #6b6585;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-soft: rgba(124, 58, 237, 0.08);
  --gradient-1: #7c3aed;
  --gradient-2: #2dd4bf;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.08);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.08);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

/* Prevent iOS zoom on input focus (requires 16px minimum) */
@supports (-webkit-touch-callout: none) {
  input[type="number"], input[type="text"], input[type="email"],
  input[type="password"], select, textarea {
    font-size: 16px !important;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 58, 237, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(45, 212, 191, 0.08), transparent);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.navbar-logo {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none !important;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.navbar-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.menu-toggle svg { width: 24px; height: 24px; display: block; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none !important;
  line-height: 1.4;
  min-height: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  color: white;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent-light); color: var(--accent); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger:hover { background: var(--danger); color: white; }

.btn-block { width: 100%; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  min-height: 50px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6585' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* Number inputs: bigger text for scores */
input[type="number"].form-control {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Clear zero on focus for number inputs */
input[type="number"].clear-zero:focus {
  /* Handled by JS */
}

/* ── Toggle switch ── */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 48px;
  padding: 8px 0;
}

.toggle input { display: none; }

.toggle-track {
  width: 54px;
  height: 32px;
  background: var(--border);
  border-radius: 16px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(22px);
}

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.15);
}

/* ── Google button ── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none !important;
}

.btn-google:hover {
  border-color: var(--accent-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ── Admin gear ── */
.admin-gear-btn {
  color: var(--text-muted);
  padding: 0;
  background: none;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
}
.admin-gear-btn:hover { color: var(--accent); }
.admin-gear-btn.active { color: var(--accent); }

/* ── User avatar ── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* ── Hero ── */
.hero {
  padding: 80px 0 48px;
  text-align: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Tools grid (home) ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  text-decoration: none !important;
  color: inherit;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tool-card:hover {
  border-color: var(--accent-light);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.1), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.tool-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
}

.tool-card h3 { font-size: 1.05rem; font-weight: 600; }
.tool-card p { color: var(--text-muted); font-size: 0.875rem; line-height: 1.55; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(45, 212, 191, 0.1));
  color: var(--accent);
  align-self: flex-start;
}

/* ── Section ── */
.section { padding-bottom: 48px; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }

/* ── Login page ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-box {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.divider {
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Burako specifics ── */
.score-big {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.score-positive { color: var(--success); }
.score-negative { color: var(--danger); }

.ronda-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 0.9rem;
}

.ronda-row:last-child { border-bottom: none; }

.ronda-num {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .hero { padding: 48px 0 32px; }
  .hero-title { font-size: 1.75rem; }
  .hero-subtitle { font-size: 1rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .score-big { font-size: 1.5rem; }

  .menu-toggle { display: block; }

  .navbar-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(245, 243, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px 20px;
    gap: 4px;
  }

  .navbar-links.open { display: flex; }
  .navbar-links a { width: 100%; padding: 10px 12px; }
}
