/* TutorIngles — base.css
   NeumorphGlass Apple — fondo azul claro, sombras neumórficas, Liquid Glass */

/* ── VARIABLES ─────────────────────────────────────────── */
:root {
  /* Fondos */
  --bg:             #d4e8f5;
  --bg-gradient:    linear-gradient(145deg, #e8f4fd 0%, #c8dff0 50%, #b8d4eb 100%);
  --surface:        rgba(255, 255, 255, 0.42);
  --surface-raised: #d4e8f5;
  --surface-inset:  #cce0ee;
  --surface-glass:  rgba(255, 255, 255, 0.35);

  /* Sombras neumórficas */
  --shadow-light:  rgba(255, 255, 255, 0.90);
  --shadow-dark:   rgba(156, 190, 214, 0.75);
  --shadow-raised: 8px 8px 18px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  --shadow-inset:  inset 4px 4px 10px var(--shadow-dark), inset -3px -3px 8px var(--shadow-light);
  --shadow-float:  12px 12px 28px rgba(156, 190, 214, 0.80), -8px -8px 20px rgba(255, 255, 255, 0.95);

  /* Glass / Liquid Glass */
  --blur:         blur(20px) saturate(180%);
  --blur-heavy:   blur(32px) saturate(200%);
  --border-glass: rgba(255, 255, 255, 0.55);
  --rim-light:    rgba(255, 255, 255, 0.80);
  --rim-bottom:   rgba(156, 190, 214, 0.25);

  /* Acento — iOS system blue */
  --accent:        #007aff;
  --accent-dim:    rgba(0, 122, 255, 0.15);
  --accent-glow:   rgba(0, 122, 255, 0.35);
  --accent-2:      #5ac8fa;
  --accent-3:      #34aadc;

  /* Niveles de inglés */
  --level-a2: #ff9f0a;
  --level-b1: #30d158;
  --level-b2: #0a84ff;
  --level-c1: #bf5af2;

  /* Texto */
  --text:          #1d1d1f;
  --text-dim:      #3c3c43;
  --text-muted:    #6e6e73;
  --text-on-accent:#ffffff;

  /* Bordes y radios */
  --radius-sm: 12px;
  --radius:    18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --border:    1px solid rgba(255, 255, 255, 0.55);

  /* Tipografía */
  --font:      -apple-system, 'Inter', BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ── Aliases de compatibilidad para el código existente ── */
  --bg-2:       var(--surface-inset);
  --surface-2:  rgba(255, 255, 255, 0.55);
  --surface-3:  rgba(156, 190, 214, 0.35);
  --text-2:     var(--text-dim);
  --text-3:     var(--text-muted);
  --text-4:     rgba(110, 110, 115, 0.40);
  --success:    #30d158;
  --warning:    #ff9f0a;
  --danger:     #ff453a;
  --info:       #5ac8fa;
  --font-sans:  var(--font);
  --accent-dark: var(--accent-3);

  /* Layout */
  --nav-h:       64px;
  --hdr-h:       88px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);
}

/* ── RESET ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  padding-top: var(--safe-top);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Textura sutil de fondo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
  z-index: 0;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

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

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

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(156,190,214,0.5); border-radius: 3px; }

/* ── LAYOUT PRINCIPAL ──────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

#hdr {
  flex-shrink: 0;
  padding: 14px 18px 10px;
  background: rgba(212, 232, 245, 0.75);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 2px 16px rgba(156, 190, 214, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.80);
}

#hdr-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

#hdr-date {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

#hdr h1 {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text);
}

#hdr h1 span { color: var(--accent); }

#hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

#xp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#xp-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-inset);
  box-shadow: var(--shadow-inset);
  border-radius: 100px;
  overflow: hidden;
}

#xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 8px var(--accent-glow);
  width: 0%;
}

#xp-text {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  white-space: nowrap;
}

#cnt {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
}

/* ── SECCIONES ─────────────────────────────────────────── */
.sec {
  display: none;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}

.sec.active { display: block; }

.sec-title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 4px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(156, 190, 214, 0.30);
}

/* ── NAV ───────────────────────────────────────────────── */
#nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  background: rgba(212, 232, 245, 0.80);
  backdrop-filter: var(--blur-heavy);
  -webkit-backdrop-filter: var(--blur-heavy);
  border-top: 1px solid rgba(255, 255, 255, 0.70);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -4px 24px rgba(156, 190, 214, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.80);
  z-index: 100;
}

.nb {
  flex: 1;
  height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 0.45rem;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  padding: 8px 4px;
}

.nb.active {
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-raised);
  color: var(--accent);
}

.ni {
  font-size: 1rem;
  display: block;
  transition: transform 0.2s;
}

.nb.active .ni { transform: scale(1.15); }

#nav-lens {
  position: absolute;
  bottom: var(--safe-bottom);
  height: var(--nav-h);
  width: calc(100% / 6);
  background: var(--accent-dim);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: left 0.3s cubic-bezier(.4,0,.2,1);
  left: 0;
  opacity: 0.5;
}

/* ── SPLASH ────────────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  background: var(--bg-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.4s, visibility 0.4s;
}

#splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-inner { text-align: center; }

.splash-logo {
  width: 72px;
  height: 72px;
  background: var(--surface-glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 2px solid var(--rim-light);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 auto 16px;
  box-shadow: var(--shadow-float);
}

.splash-title {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  letter-spacing: 4px;
  color: var(--text);
  margin-bottom: 4px;
}

.splash-title span { color: var(--accent); }

.splash-sub {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.splash-bar {
  width: 120px;
  height: 4px;
  background: var(--surface-inset);
  box-shadow: var(--shadow-inset);
  border-radius: 100px;
  margin: 0 auto;
  overflow: hidden;
}

.splash-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  border-radius: 100px;
  animation: splashLoad 1.2s ease forwards;
}

@keyframes splashLoad {
  from { width: 0%; }
  to   { width: 100%; }
}

/* ── LOCK (AUTH) ───────────────────────────────────────── */
#lock {
  position: fixed;
  inset: 0;
  background: var(--bg-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
}

.lock-card {
  width: min(340px, 90vw);
  padding: 36px 28px;
  background: var(--surface-glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--rim-light);
  border-bottom: 1px solid var(--rim-bottom);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255,255,255,0.65);
  text-align: center;
}

.lock-logo {
  width: 56px;
  height: 56px;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 auto 16px;
  box-shadow: var(--shadow-raised);
}

.lock-card h2 {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 3px;
  color: var(--text);
  margin-bottom: 6px;
}

.lock-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.lock-card input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-inset);
  border: 1px solid rgba(255,255,255,0.60);
  box-shadow: var(--shadow-inset);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 2px;
}

.lock-err {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--danger);
  min-height: 18px;
}

/* ── OFFLINE BANNER ────────────────────────────────────── */
#offline-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: var(--warning);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 2px;
  padding: 6px 20px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 200;
  transition: transform 0.3s;
  white-space: nowrap;
}

#offline-banner.visible { transform: translateX(-50%) translateY(0); }

/* ── TOASTS ────────────────────────────────────────────── */
#toasts {
  position: fixed;
  top: calc(var(--safe-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface-glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255,255,255,0.70);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.8rem;
  color: var(--text);
  box-shadow: var(--shadow-raised);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  white-space: nowrap;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger);  }

@keyframes toastIn  { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }
