/* ============================================
   KIDOORY — Main Stylesheet
   Premium children's book platform
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;1,9..144,300;1,9..144,400&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --cream: #FDFAF4;
  --warm-white: #FAF7F0;
  --ink: #1A1510;
  --ink-soft: #3D3529;
  --ink-muted: #7A6F62;
  --gold: #C8862A;
  --gold-light: #F0C870;
  --gold-pale: #FDF3DC;
  --teal: #2A7A6A;
  --teal-light: #E0F0EC;
  --coral: #D45E3C;
  --coral-light: #FBE9E3;
  --lilac: #7B5EA7;
  --lilac-light: #EDE8F5;
  --border: rgba(26,21,16,0.10);
  --border-strong: rgba(26,21,16,0.20);
  --shadow-soft: 0 4px 32px rgba(26,21,16,0.06);
  --shadow-card: 0 8px 48px rgba(26,21,16,0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 100px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4 { font-family: 'Fraunces', serif; font-weight: 300; letter-spacing: -1px; }
h1 { font-size: clamp(44px, 5vw, 72px); line-height: 1.04; }
h2 { font-size: clamp(32px, 4vw, 54px); line-height: 1.08; }
h3 { font-size: clamp(20px, 2.5vw, 28px); line-height: 1.2; }
em { font-style: italic; color: var(--gold); }
strong { font-weight: 500; }

/* ---- NAV ---- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 18px 48px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(253,250,244,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: 'Fraunces', serif; font-size: 24px; font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: -0.5px;
}
.nav-logo span { color: var(--gold); }
.nav-links { display: flex; align-items: center; gap: 32px; list-style: none; }
.nav-links a { text-decoration: none; color: var(--ink-muted); font-size: 15px; transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  background: var(--ink) !important; color: var(--cream) !important;
  padding: 10px 22px; border-radius: var(--radius-pill);
  font-weight: 500 !important; font-size: 14px !important;
  transition: transform 0.2s, background 0.2s !important;
}
.nav-cta:hover { background: var(--ink-soft) !important; transform: translateY(-1px); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: var(--radius-pill);
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer; border: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn-dark { background: var(--ink); color: var(--cream); box-shadow: 0 4px 20px rgba(26,21,16,0.18); }
.btn-dark:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(26,21,16,0.25); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--border-strong); }
.btn-outline:hover { background: var(--warm-white); transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: white; box-shadow: 0 4px 20px rgba(200,134,42,0.3); }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(200,134,42,0.4); }
.btn-lg { padding: 18px 36px; font-size: 17px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- FORM ELEMENTS ---- */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--ink-soft); letter-spacing: 0.2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: 'DM Sans', sans-serif;
  color: var(--ink); background: var(--cream);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--ink-muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(200,134,42,0.10);
  background: white;
}
.form-textarea { resize: none; height: 100px; }

/* ---- CARDS ---- */
.card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  box-shadow: var(--shadow-soft);
}
.card-lg { padding: 48px; border-radius: 24px; }

/* ---- SECTION LAYOUT ---- */
.section {
  padding: 100px 48px;
  max-width: 1280px; margin: 0 auto;
}
.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 3px;
  color: var(--gold); font-weight: 500; margin-bottom: 14px;
}
.section-sub {
  font-size: 17px; color: var(--ink-muted); font-weight: 300;
  max-width: 520px; line-height: 1.7; margin-top: 14px; margin-bottom: 56px;
}

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500;
}
.badge-gold { background: var(--gold-pale); color: var(--gold); border: 1px solid rgba(200,134,42,0.2); }
.badge-teal { background: var(--teal-light); color: var(--teal); }
.badge-coral { background: var(--coral-light); color: var(--coral); }
.badge-lilac { background: var(--lilac-light); color: var(--lilac); }

/* ---- ALERTS ---- */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px; border-radius: var(--radius-sm);
}
.alert-privacy { background: var(--teal-light); border: 1px solid rgba(42,122,106,0.2); color: var(--teal); }
.alert-warning { background: var(--gold-pale); border: 1px solid rgba(200,134,42,0.2); color: var(--gold); }
.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert p { font-size: 13px; line-height: 1.6; }

/* ---- LOADING SPINNER ---- */
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- PROGRESS BAR ---- */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill {
  height: 100%; background: var(--gold); border-radius: 2px;
  transition: width 0.4s ease;
}

/* ---- SUPPORT BOT ---- */
.chat-widget {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
}
.chat-trigger {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ink); color: white;
  border: none; cursor: pointer; font-size: 22px;
  box-shadow: 0 4px 24px rgba(26,21,16,0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.chat-trigger:hover { transform: scale(1.08); box-shadow: 0 8px 32px rgba(26,21,16,0.3); }
.chat-window {
  position: absolute; bottom: 70px; right: 0;
  width: 360px; height: 480px;
  background: white; border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 64px rgba(26,21,16,0.15);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  opacity: 0; pointer-events: none;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  transform-origin: bottom right;
}
.chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1; pointer-events: all;
}
.chat-header {
  padding: 16px 20px;
  background: var(--ink); color: white;
  display: flex; align-items: center; gap: 12px;
}
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); display: flex; align-items: center;
  justify-content: center; font-size: 18px;
}
.chat-header-info .name { font-weight: 500; font-size: 15px; }
.chat-header-info .status { font-size: 12px; opacity: 0.6; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5;
}
.chat-msg.bot {
  background: var(--warm-white); color: var(--ink);
  border-radius: 4px 14px 14px 14px; align-self: flex-start;
}
.chat-msg.user {
  background: var(--ink); color: white;
  border-radius: 14px 4px 14px 14px; align-self: flex-end;
}
.chat-typing { display: flex; gap: 4px; padding: 10px 14px; align-self: flex-start; }
.chat-typing span {
  width: 7px; height: 7px; background: var(--ink-muted);
  border-radius: 50%; animation: bounce 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-8px)} }
.chat-input-area {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}
.chat-input {
  flex: 1; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-pill); font-size: 14px;
  font-family: 'DM Sans', sans-serif; outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--gold); }
.chat-send {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: background 0.2s;
}
.chat-send:hover { background: var(--ink-soft); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .nav { padding: 14px 20px; }
  .nav-links { display: none; }
  .section { padding: 64px 20px; }
  .card-lg { padding: 28px 20px; }
  h1 { letter-spacing: -0.5px; }
}
