/* ===== KidStoryAI — Playful Pink Theme ===== */
:root {
  --primary: #EC4899;
  --primary-light: #F9A8D4;
  --primary-dark: #BE185D;
  --accent: #8B5CF6;
  --bg: #FFF1F5;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-muted: #6B7280;
  --border: #F3E8FF;
  --success: #10B981;
  --error: #EF4444;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(236, 72, 153, 0.10);
  --shadow-lg: 0 8px 40px rgba(236, 72, 153, 0.15);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* --- Layout --- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.page { padding: 40px 0 80px; }

/* --- Nav --- */
nav {
  background: white;
  border-bottom: 2px solid var(--primary-light);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(236,72,153,0.06);
}
nav .nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
nav .logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
nav .logo span { font-size: 1.6rem; }
nav .nav-links { display: flex; align-items: center; gap: 24px; }
nav .nav-links a {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
nav .nav-links a:hover { color: var(--primary); }
nav .nav-links .btn-sm {
  background: var(--primary);
  color: white;
  padding: 8px 20px;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s;
}
nav .nav-links .btn-sm:hover { background: var(--primary-dark); color: white; }

/* Mobile nav */
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); }
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  nav .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    border-bottom: 2px solid var(--primary-light);
    box-shadow: var(--shadow);
  }
  nav .nav-links.open { display: flex; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #7C3AED; color: white; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--primary); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #DC2626; color: white; }
.btn-sm-size { padding: 10px 20px; font-size: 0.9rem; }
.btn-block { width: 100%; }

/* --- Cards --- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 80px 20px;
  background: linear-gradient(135deg, #FFF1F5 0%, #FDE7F3 50%, #F3E8FF 100%);
}
.hero h1 {
  font-size: 3.2rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.15;
}
.hero h1 em { color: var(--primary); font-style: normal; }
.hero p { font-size: 1.25rem; color: var(--text-muted); max-width: 600px; margin: 0 auto 32px; }
.hero-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 600px) {
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
}

/* --- Features --- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; padding: 60px 0; }
.feature-card {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text); }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; }

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.95rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* --- Flash messages --- */
.flash {
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-weight: 500;
  font-size: 0.95rem;
}
.flash-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* --- Auth pages --- */
.auth-page {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  background: white;
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.auth-card h1 {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 8px;
}
.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.auth-footer { text-align: center; margin-top: 24px; color: var(--text-muted); }

/* --- Dashboard --- */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}
.dash-header h1 { font-size: 2rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.stat-card .stat-num { font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* --- Story card grid --- */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.story-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
}
.story-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.story-card-header {
  background: linear-gradient(135deg, var(--primary-light) 0%, #C4B5FD 100%);
  padding: 24px;
  color: white;
}
.story-card-header h3 { font-size: 1.1rem; color: white; }
.story-card-header .story-meta { font-size: 0.85rem; opacity: 0.9; margin-top: 4px; }
.story-card-body { padding: 20px; flex: 1; }
.story-card-body p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }
.story-card-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 12px; }

/* --- Story view --- */
.story-view { max-width: 720px; margin: 0 auto; }
.story-view h1 { font-size: 2.2rem; color: var(--primary-dark); margin-bottom: 8px; }
.story-view .story-info { color: var(--text-muted); margin-bottom: 32px; font-size: 0.95rem; }
.story-view .story-content {
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--text);
}
.story-view .story-content p { margin-bottom: 1.2em; }
.story-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; padding-top: 24px; border-top: 2px solid var(--border); }

/* --- Characters --- */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.char-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 2px solid var(--primary-light);
}
.char-card h3 { color: var(--primary); margin-bottom: 8px; }
.char-card .char-detail { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 4px; }
.char-card .char-actions { margin-top: 16px; display: flex; gap: 8px; }

/* --- Pricing --- */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; max-width: 700px; margin: 0 auto; }
.price-card {
  background: white;
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  position: relative;
}
.price-card.featured { border-color: var(--primary); }
.price-card .badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 4px 20px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.price-card h3 { font-size: 1.3rem; margin-bottom: 8px; }
.price-card .price { font-size: 2.8rem; font-weight: 900; color: var(--primary); margin: 16px 0; }
.price-card .price span { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.price-card ul { list-style: none; margin: 24px 0; text-align: left; }
.price-card ul li { padding: 8px 0; color: var(--text-muted); font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.price-card ul li::before { content: "\2713"; color: var(--success); font-weight: 700; }

/* --- Pagination --- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination a, .pagination span {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
.pagination a { background: white; border: 1px solid var(--border); color: var(--text); }
.pagination a:hover { background: var(--primary-light); }
.pagination .active { background: var(--primary); color: white; }

/* --- Loading --- */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
}
.loading-overlay.active { display: flex; }
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 1.1rem; color: var(--primary); font-weight: 600; }

/* --- Footer --- */
footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* --- Utilities --- */
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 32px; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
