/* ChartKids — shared stylesheet for all activity/worksheet pages */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f0f1a;
  --surface:  #1a1a2e;
  --surface2: #232340;
  --border:   #2e2e50;
  --accent:   #7c3aed;
  --accent2:  #06b6d4;
  --green:    #22c55e;
  --yellow:   #fbbf24;
  --pink:     #ec4899;
  --text:     #f1f5f9;
  --muted:    #94a3b8;
  --radius:   16px;
}

body {
  font-family: 'Nunito', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ── HEADER ─────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  white-space: nowrap;
}
.logo span { -webkit-text-fill-color: var(--yellow); }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── NAV ─────────────────────────────────────────── */
.main-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.main-nav a {
  font-size: .82rem;
  font-weight: 800;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 50px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.main-nav a:hover { background: rgba(124,58,237,.15); color: var(--text); }
.main-nav a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
}

/* ── LANG TOGGLE ─────────────────────────────────── */
.lang-toggle { display: flex; gap: 2px; }
.lang-btn {
  padding: 5px 11px;
  border-radius: 50px;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lang-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  box-shadow: 0 2px 8px rgba(124,58,237,.4);
}
.lang-btn:not(.active):hover { color: var(--text); }

/* ── PAGE LAYOUT ─────────────────────────────────── */
.page-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 28px;
  padding: 28px 0;
  align-items: start;
}
@media (max-width: 720px) { .page-layout { grid-template-columns: 1fr; } }

.page-main h1 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  margin-bottom: 12px;
  color: var(--text);
}

/* ── SIDEBAR ─────────────────────────────────────── */
.page-sidebar { position: sticky; top: 72px; }
.sidebar-promo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-promo::before {
  content: '✨ Más fichas';
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 2px;
}
.promo-link {
  display: block;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.promo-link:hover { border-color: var(--accent); color: var(--accent2); }

/* ── PRINT AREA (worksheet card) ─────────────────── */
.print-area {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
  margin-bottom: 16px;
}
.print-area svg { width: 100%; height: auto; display: block; }

/* ── PAGE ACTIONS ────────────────────────────────── */
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-print {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border: none;
  padding: 11px 24px;
  border-radius: 50px;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .2s;
  box-shadow: 0 4px 12px rgba(124,58,237,.35);
}
.btn-print:hover { opacity: .88; }
.btn-secondary {
  display: inline-block;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 11px 20px;
  border-radius: 50px;
  font-size: .88rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color .15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent2); }

/* ── PILL BADGE ──────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 800;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  margin-right: 4px;
}

/* ── HERO SECTION (index pages) ──────────────────── */
.activity-hero {
  text-align: center;
  padding: 40px 20px;
  border-radius: var(--radius);
  margin-bottom: 32px;
  background: linear-gradient(135deg, rgba(124,58,237,.18), rgba(6,182,212,.1));
  border: 1px solid var(--border);
}
.activity-hero h1 {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  margin-bottom: 8px;
}
.activity-hero p { color: var(--muted); font-size: 1rem; }

/* ── CARDS GRID ──────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
  display: block;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-title { font-size: .95rem; font-weight: 800; margin-bottom: 4px; }
.card-age { font-size: .78rem; color: var(--muted); font-weight: 700; }

/* ── CATEGORY SECTION ────────────────────────────── */
.category-section { margin-bottom: 36px; }
.cat-heading {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 10px;
  padding-left: 4px;
}

/* ── FOOTER ──────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 60px;
  font-size: .875rem;
}
.footer-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
}
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--text); }

/* ── /crear/ SPECIFIC ────────────────────────────── */
.crear-hero {
  text-align: center;
  padding: 36px 20px;
  background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(6,182,212,.15));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
}
.crear-hero h1 { font-family: 'Fredoka One', cursive; font-size: 2rem; margin-bottom: 8px; }
.crear-hero p { color: var(--muted); }

.crear-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 580px;
  margin: 0 auto 28px;
}
.form-group { margin-bottom: 22px; }
.form-group label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
  font-size: .9rem;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group input::placeholder { color: var(--muted); }

.color-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.color-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.color-btn.active, .color-btn:hover {
  transform: scale(1.15);
  border-color: white;
  box-shadow: 0 0 0 2px var(--accent);
}

.emoji-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.emoji-btn {
  font-size: 1.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 46px; height: 46px;
  cursor: pointer;
  transition: all .15s;
}
.emoji-btn.active, .emoji-btn:hover {
  background: rgba(124,58,237,.2);
  border-color: var(--accent);
  transform: scale(1.1);
}

.tipo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.tipo-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
}
.tipo-card:hover, .tipo-card.active {
  border-color: var(--accent);
  background: rgba(124,58,237,.12);
}
.tipo-card .icon { font-size: 1.6rem; margin-bottom: 4px; }
.tipo-card .name { font-weight: 800; font-size: .88rem; }
.tipo-card .desc { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.badge-pronto {
  font-size: .65rem;
  background: var(--surface);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-top: 4px;
  border: 1px solid var(--border);
}

.btn-generate {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .2s;
  box-shadow: 0 4px 16px rgba(124,58,237,.4);
}
.btn-generate:hover { opacity: .9; }
.btn-generate:disabled { opacity: .4; cursor: not-allowed; }

.examples {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 580px;
  margin: 0 auto 24px;
}
.examples h3 {
  font-size: .78rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.example-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  color: var(--text);
}
.chip:hover { border-color: var(--accent); color: var(--accent2); }

.loading { text-align: center; padding: 40px; color: var(--muted); font-weight: 800; display: none; }

.preview-area { max-width: 580px; margin: 0 auto 24px; display: none; }
.preview-area iframe {
  width: 100%;
  height: 700px;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
}
.preview-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.btn-otra {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 11px 24px;
  border-radius: 50px;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.btn-otra:hover { border-color: var(--accent); }

/* ── PRINT OVERRIDE ──────────────────────────────── */
@media print {
  body { background: white !important; color: #1e293b !important; }
  .site-header, .page-actions, .page-sidebar, .site-footer,
  .preview-actions, .crear-form, .examples { display: none !important; }
  .page-layout { display: block !important; padding: 0 !important; }
  .print-area { box-shadow: none !important; border-radius: 0 !important; }
}

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { gap: 8px; }
  .main-nav a { font-size: .75rem; padding: 5px 8px; }
  .logo { font-size: 1.25rem; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .page-main h1 { font-size: 1.3rem; }
}
