/* =====================================================
   NNAC · Caja de Herramientas Digital
   main.css — Variables, base, layout, tipografía
   ===================================================== */

/* ---------- Variables ---------- */
:root {
  /* Paleta principal NNAC (lúdica y profesional) */
  --color-primary: #7a2e6d;          /* Morado NNAC */
  --color-primary-dark: #5c1f52;
  --color-primary-light: #9e4b8f;
  --color-accent: #f6a21c;           /* Ámbar */
  --color-accent-dark: #d98208;
  --color-success: #2e9e5b;
  --color-danger: #d63939;
  --color-warning: #f0ad4e;

  /* Neutros */
  --color-bg: #fdf8f3;
  --color-bg-alt: #f3e9f7;
  --color-surface: #ffffff;
  --color-text: #2d2430;
  --color-text-muted: #6b5d72;
  --color-border: #e5d7e8;

  /* Fondo degradados lúdicos */
  --grad-hero: linear-gradient(135deg, #8e3b7d 0%, #a44e93 45%, #c96f4e 100%);
  --grad-card-top: linear-gradient(90deg, #7a2e6d, #a44e93);

  /* Medidas */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(122, 46, 109, .08);
  --shadow: 0 6px 20px rgba(122, 46, 109, .12);
  --shadow-lg: 0 16px 40px rgba(122, 46, 109, .18);
  --container: 1200px;
  --header-h: 72px;

  /* Tipografía */
  --font-display: 'Baloo 2', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color .2s;
}

a:hover, a:focus-visible {
  color: var(--color-primary-dark);
}

ul, ol { list-style: none; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
}

/* Focus visible accesible */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Tipografía ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--color-text);
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
h3 { font-size: 1.15rem; }

/* ---------- Botones (base) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.3;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  text-align: center;
  border: 2px solid transparent;
}

.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(122, 46, 109, .3);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-ghost:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: #fff;
  border-color: #fff;
}
.btn-outline:hover { background: rgba(255,255,255,.16); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }

.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.header-top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo { width: 150px; height: auto; }

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--color-primary);
}
.brand-text small { color: var(--color-text-muted); font-size: .8rem; }

.main-nav .nav-list {
  display: flex;
  gap: 8px;
}

.nav-link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--color-text);
}

.nav-link:hover, .nav-link.active {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-name {
  font-weight: 700;
  color: var(--color-primary);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hamburguesa móvil */
.nav-toggle { display: none; }
.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  position: relative;
  border-radius: 2px;
}
.hamburger::before, .hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
}
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: var(--grad-hero);
  color: #fff;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 40px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 120px;
}

.hero-text h1 { color: #fff; margin-bottom: 16px; }
.hero-text h1 .highlight {
  color: var(--color-accent);
  display: inline-block;
  transform: rotate(-3deg);
}
.hero-text p {
  font-size: 1.15rem;
  color: rgba(255,255,255,.9);
  max-width: 540px;
  margin-bottom: 28px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-art { display: flex; justify-content: center; }
.hero-img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 340px;
  width: 100%;
  background: rgba(255,255,255,.15);
  padding: 12px;
}

.hero-wave {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 70px;
  background: var(--color-bg);
  clip-path: polygon(0 100%, 100% 100%, 100% 0, 50% 100%);
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
  font-size: .9rem;
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
}
.breadcrumbs li + li::before { content: '›'; color: var(--color-text-muted); }
.breadcrumbs a { font-weight: 700; color: var(--color-primary); }
.breadcrumbs .current { color: var(--color-text); font-weight: 700; }

/* ---------- Toolbar / Búsqueda ---------- */
.toolbar-section { padding: 40px 0 8px; }

.search-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.search-panel h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: var(--color-primary);
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-row input[type="search"] {
  flex: 1;
  padding: 12px 18px;
  border-radius: 999px;
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  transition: border-color .2s;
}

.search-row input[type="search"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filters-row label {
  flex: 1 1 160px;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.filters-row select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
}
.filters-row select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ---------- Resultados ---------- */
.results-section { padding: 24px 0 48px; }

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.results-header h2 { color: var(--color-text); }
.results-count {
  font-weight: 700;
  color: var(--color-text-muted);
  font-size: .9rem;
  background: var(--color-bg-alt);
  padding: 4px 12px;
  border-radius: 999px;
}

/* Skeleton */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.skeleton-card {
  height: 260px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, #eee 25%, #f7f7f7 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Grid de tarjetas */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Vacío */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--color-text-muted);
}
.empty-state svg { margin: 0 auto 16px; color: var(--color-text-muted); }
.empty-state h3 { margin-bottom: 8px; color: var(--color-text); }
.empty-state p { margin-bottom: 20px; }
.empty-state .btn { margin: 0 auto; }

/* ---------- Módulos ---------- */
.modules-section {
  padding: 56px 0;
  background: var(--color-bg-alt);
}

.section-title {
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 8px;
}
.section-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto 32px;
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,.85);
  margin-top: auto;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  padding: 40px 20px 24px;
  max-width: var(--container);
  margin: 0 auto;
}

.footer-brand p { margin: 6px 0; }
.footer-brand strong { color: #fff; }

.footer-links h3 {
  color: var(--color-accent);
  font-size: 1rem;
  margin-bottom: 12px;
}
.footer-links ul { display: grid; gap: 8px; }
.footer-links a { color: rgba(255,255,255,.85); }
.footer-links a:hover { color: var(--color-accent); }

.footer-logos {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: flex-end;
}
.inst-logo {
  width: 72px;
  height: auto;
  background: #fff;
  border-radius: 10px;
  padding: 6px;
  object-fit: contain;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  padding: 16px 20px;
  text-align: center;
  font-size: .85rem;
}