/* =====================================================
   styles.css — Base compartida de ForjaTu
   Incluir en TODAS las páginas, después de las fuentes
   y ANTES de cualquier <style> específico de la página:

     <link rel="stylesheet" href="styles.css">

   Contiene SOLO lo que se repite en toda la app:
   variables, sidebar, modal de auth, toast, layout base
   (main/topbar/content) y botones comunes.

   Lo específico de cada página (hero de index, tablero
   del Wordle, settings-section de ajustes...) se queda
   en el <style> propio de esa página.
===================================================== */

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

:root {
  /* Fondos */
  --bg: #f5f4f0;
  --bg2: #ffffff;
  --bg3: #f0efe9;
  --bg4: #e8e6df;
  /* Bordes */
  --border: #e5e3dc;
  --border2: #d4d2ca;
  /* Textos */
  --text: #1a1a1a;
  --text2: #666660;
  --text3: #9999aa;
  /* Marca */
  --violet: #6c47ff;
  --violet-light: #ede9ff;
  --violet-mid: #c4b5fd;
  --pink: #ff3d8a;
  --pink-light: #ffe0ef;
  /* Paleta extendida (cursos, categorías, tags) */
  --orange: #ff6b2b;
  --orange-light: #fff0ea;
  --teal: #00bfa5;
  --teal-light: #e0faf6;
  --yellow: #f59e0b;
  --yellow-light: #fef3c7;
  /* Feedback */
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  /* Layout */
  --sidebar: 270px;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   SIDEBAR (inyectado por sidebar.js dentro de
   <div id="sidebar-container">)
══════════════════════════════════════════════════════ */
aside {
  width: var(--sidebar);
  height: 100vh;
  background: var(--bg2);
  border-right: 5px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  overflow-y: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  cursor: pointer;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo-text span {
  background: linear-gradient(90deg, var(--violet), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-block {
  background: linear-gradient(135deg, var(--violet-light), var(--pink-light));
  border: 1px solid var(--violet-mid);
  border-radius: 12px;
  padding: .875rem 1rem;
  margin-bottom: 1.25rem;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.user-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 71, 255, .15);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-info .user-cta { font-size: 11px; color: var(--violet); font-weight: 500; white-space: nowrap; }

nav { flex: 1; }

.nav-label {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .25rem .5rem;
  margin-bottom: .4rem;
  margin-top: .25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem .875rem;
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 2px;
  font-weight: 500;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--violet-light); color: var(--violet); font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: var(--violet);
  color: #fff;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════
   MODAL DE AUTH (inyectado por sidebar.js)
══════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, .6);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border-radius: 20px;
  padding: 2rem;
  width: 380px;
  max-width: 92vw;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .18);
  animation: mIn .2s ease;
  position: relative;
}

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

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg3);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal h2 { font-weight: 800; font-size: 22px; margin-bottom: .3rem; color: var(--text); }
.modal p { font-size: 13.5px; color: var(--text2); margin-bottom: 1.5rem; }

.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1.25rem;
  background: var(--bg3);
  padding: 4px;
  border-radius: 10px;
}

.modal-tab {
  flex: 1;
  padding: .5rem;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text2);
  border: none;
  background: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all .15s;
}

.modal-tab.active { background: var(--bg2); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }

/* ══════════════════════════════════════════════════════
   CAMPOS Y BOTONES COMUNES
   (usados en el modal de auth y en perfil/ajustes)
══════════════════════════════════════════════════════ */
.field { margin-bottom: .875rem; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: .35rem; }

.field input {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .7rem .875rem;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  transition: border-color .2s;
  outline: none;
}

.field input:focus { border-color: var(--violet); }
.field input:disabled { color: var(--text3); cursor: not-allowed; }

.btn-main {
  width: 100%;
  padding: .85rem;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-top: .5rem;
  transition: all .2s;
}

.btn-main:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108, 71, 255, .35); }
.btn-main:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: .7rem 1.25rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
}

.btn-secondary:hover { background: var(--bg4); }
.btn-secondary:disabled { opacity: .6; cursor: not-allowed; }

.btn-danger {
  background: var(--red-light);
  border: 1.5px solid #fca5a5;
  color: var(--red);
  border-radius: 10px;
  padding: .7rem 1.25rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
}

.btn-danger:hover { background: #fecaca; }

/* ══════════════════════════════════════════════════════
   LAYOUT BASE (main / topbar / content)
   Cada página puede añadir estilos propios encima
══════════════════════════════════════════════════════ */
main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; color: var(--text); }

.content { padding: 2rem; flex: 1; }

footer {
  border-top: 1.5px solid var(--border);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg2);
}

.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { font-size: 12px; color: var(--text3); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--text2); }
.footer-copy { font-size: 12px; color: var(--text3); }

/* ══════════════════════════════════════════════════════
   TOAST (inyectado por sidebar.js)
══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--text);
  color: var(--bg2);
  padding: .875rem 1.25rem;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: .6rem;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
}

/* ══════════════════════════════════════════════════════
   SCROLLBAR + RESPONSIVE BASE
══════════════════════════════════════════════════════ */
main::-webkit-scrollbar { width: 5px; }
main::-webkit-scrollbar-track { background: transparent; }
main::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

@media(max-width: 700px) {
  aside { display: none; }
}
