/* ==========================================================================
   Petit Genius - Design System & Stylesheet (Tabbed UI Version)
   Light, warm theme — this is a tool for parents, not a gaming dashboard.
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-page: #FBF9F5;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FFFFFF;
  --bg-input: #F6F5F2;

  --border-subtle: rgba(30, 27, 46, 0.10);
  --border-glow: rgba(139, 92, 246, 0.35);

  --text-main: #221E33;
  --text-muted: #6B6B7B;
  --text-dim: #97949F;

  /* Primary & Accent Gradients (kept as warm brand accents, not the dominant background) */
  --primary-purple: #8b5cf6;
  --primary-pink: #ec4899;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-cyan: #06b6d4;

  --gradient-brand: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #f43f5e 100%);
  --gradient-glow: radial-gradient(circle, rgba(139, 92, 246, 0.10) 0%, rgba(0, 0, 0, 0) 70%);

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Geometry & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 9999px;

  --shadow-sm: 0 4px 16px rgba(30, 27, 46, 0.06);
  --shadow-glow: 0 10px 26px -6px rgba(139, 92, 246, 0.35);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base & Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  background-image:
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.07) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.06) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.04) 0px, transparent 70%);
  background-attachment: fixed;
}

/* --- Typography Utilities --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* --- Container & Layout --- */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Navigation & Tabs --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(251, 249, 245, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 0;
}

.nav-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  row-gap: 0.6rem;
  column-gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  background: rgba(30, 27, 46, 0.045);
  padding: 0.3rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  display: inline-block;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(30, 27, 46, 0.05);
}

.nav-tab.active {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.nav-tab.active:hover {
  background: var(--gradient-brand);
  color: #fff;
}

.nav-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .nav-container {
    justify-content: flex-start;
  }
  .logo {
    order: 1;
  }
  .nav-actions {
    order: 2;
    margin-left: auto;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
  }
  #nav-account-status {
    display: none;
  }
}

/* --- Tab Contents Toggle --- */
.tab-content {
  display: none;
  padding: 4rem 0;
}

@media (max-width: 640px) {
  .tab-content {
    padding: 2.5rem 0;
  }
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.35s ease-out;
}

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -6px rgba(236, 72, 153, 0.35);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(30, 27, 46, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(30, 27, 46, 0.09);
  border-color: rgba(30, 27, 46, 0.18);
}

/* --- Hero & Sections --- */
.hero {
  padding: 3.5rem 0 2rem;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #6d28d9;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  max-width: 900px;
  margin: 0 auto 1.5rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 2.5rem;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

/* --- Cards --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.10);
}

/* --- Core Values Grid --- */
.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-title {
  font-size: 2.3rem;
  margin-bottom: 1rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.value-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.value-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-brand);
  opacity: 0;
  transition: var(--transition);
}

.value-card:hover::before {
  opacity: 1;
}

.value-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.value-icon {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.value-title {
  font-size: 1.2rem;
}

.value-description {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* --- Generator Section --- */
.generator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 992px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-dim);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
  background: #fff;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  background: rgba(30, 27, 46, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.chip:hover {
  background: rgba(30, 27, 46, 0.08);
}

.chip.selected {
  background: rgba(139, 92, 246, 0.14);
  border-color: var(--primary-purple);
  color: #6d28d9;
}

/* --- Generated Worksheet Preview --- */
.preview-card {
  background: #ffffff;
  color: #1e293b;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  position: relative;
  min-height: 520px;
}

@media (max-width: 640px) {
  .preview-card {
    padding: 1.5rem;
  }
}

.preview-header {
  border-bottom: 2px dashed #cbd5e1;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: flex-start;
}

.preview-tag {
  background: #f1f5f9;
  color: #475569;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.preview-title {
  color: #0f172a;
  font-size: 1.5rem;
  margin-top: 0.4rem;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.value-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.value-badge-item {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
}

.preview-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.preview-section-title {
  color: #0f172a;
  font-size: 1.1rem;
  border-left: 3px solid #8b5cf6;
  padding-left: 0.6rem;
}

.preview-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-list li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.95rem;
}

.preview-list li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: #8b5cf6;
}

.preview-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.9rem;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 3rem 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
}

/* --- Print Styles for Worksheets --- */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .navbar, .hero, .footer, .btn, .nav-tabs {
    display: none !important;
  }
  .preview-card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
}
