/* ==========================================================
   Sistema visual compartido con irakasle.edurobotic.es
   (mismos colores, tipografía, header y tarjetas)
   ========================================================== */
:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --primary: #17A9E0;
  --primary-dark: #0E86B4;
  --accent: #8DC63F;
  --accent-dark: #6FA82E;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 28px rgba(0,0,0,0.15);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}

/* ── LOGIN ── */
#login-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #123A5E 0%, #17A9E0 65%, #8DC63F 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 24px; padding: 48px 40px;
  text-align: center; max-width: 380px; width: 100%; color: white;
}
.login-logo-img { width: 90px; height: 90px; display: block; margin: 0 auto 16px; filter: drop-shadow(0 4px 14px rgba(0,0,0,0.3)); }
.login-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { font-size: 0.9rem; opacity: 0.75; margin-bottom: 32px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form input[type="password"] {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: none;
  font-size: 1rem; text-align: center; font-family: inherit;
}
.login-form input[type="password"]:focus { outline: 2px solid white; }
.btn-entrar {
  width: 100%; padding: 14px 24px; background: white; color: var(--primary-dark);
  border: none; border-radius: 12px; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.btn-entrar:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.login-error {
  margin-top: 16px; padding: 12px 16px;
  background: rgba(239,68,68,0.2); border: 1px solid rgba(239,68,68,0.4);
  border-radius: 10px; font-size: 0.85rem;
}

/* ── HEADER ── */
header {
  background: linear-gradient(135deg, #123A5E 0%, #17A9E0 65%, #8DC63F 100%);
  color: white; padding: 20px 32px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.header-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.header-logo-img { height: 46px; width: 46px; display: block; border-radius: 50%; }
.header-titles { flex: 1; }
.header-titles h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.header-titles p { font-size: 0.82rem; opacity: 0.8; margin-top: 2px; }
.btn-logout {
  padding: 6px 14px; background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 8px;
  color: white; font-size: 0.8rem; cursor: pointer; font-family: inherit;
  text-decoration: none; transition: background 0.2s; white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,0.28); }

/* ── NAV TABS ── */
.nav-tabs { background: var(--surface); border-bottom: 2px solid var(--border); padding: 0 32px; }
.nav-tabs-inner { max-width: 1400px; margin: 0 auto; display: flex; }
.nav-tab {
  padding: 14px 24px; font-size: 0.9rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: all 0.2s; display: flex; align-items: center; gap: 8px;
  background: none; border-top: none; border-left: none; border-right: none; font-family: inherit;
}
.nav-tab:hover { color: var(--primary); }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── CONTROLES / FILTROS ── */
.controls { max-width: 1400px; margin: 24px auto 0; padding: 0 32px; display: flex; flex-direction: column; gap: 16px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-right: 4px; }
.filter-btn {
  padding: 7px 16px; border-radius: 20px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.filter-btn.nb.active { background: #10b981; border-color: #10b981; }
.filter-btn.nm.active { background: #f59e0b; border-color: #f59e0b; }
.filter-btn.na.active { background: #ef4444; border-color: #ef4444; }

/* ── GRID / TARJETA ── */
.grid-section { max-width: 1400px; margin: 20px auto 48px; padding: 0 32px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-thumb { position: relative; aspect-ratio: 16/9; background: #1a1a2e; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge-nivel { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; backdrop-filter: blur(4px); }
.nivel-basico   { background: rgba(16,185,129,0.85); color: white; }
.nivel-medio    { background: rgba(245,158,11,0.85);  color: white; }
.nivel-avanzado { background: rgba(239,68,68,0.85);   color: white; }
.card-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card-title { font-size: 0.95rem; font-weight: 700; line-height: 1.3; color: var(--text); text-transform: uppercase; }
.card-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-btn {
  margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px; background: #123A5E; color: white; font-weight: 700; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.05em; border-radius: 10px; text-decoration: none;
  transition: background 0.2s;
}
.card-btn:hover { background: var(--primary); }

/* ── EMPTY / LOADING ── */
.hidden { display: none; }
.state-msg { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--text-muted); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
