/* ChildDraw v2 - Ultra Premium & Playful Kids Design System */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Quicksand:wght@500;600;700;800&display=swap');

:root {
  --primary: #6C5CE7;
  --primary-hover: #5B4BC4;
  --primary-gradient: linear-gradient(135deg, #74B9FF 0%, #6C5CE7 50%, #A29BFE 100%);
  --secondary: #FF7675;
  --secondary-gradient: linear-gradient(135deg, #FF7675 0%, #FD79A8 100%);
  --accent-yellow: #FDCB6E;
  --accent-yellow-gradient: linear-gradient(135deg, #FFEAA7 0%, #FDCB6E 100%);
  --accent-green: #00B894;
  --accent-green-gradient: linear-gradient(135deg, #55E6C1 0%, #00B894 100%);
  --accent-pink: #FD79A8;
  --accent-cyan: #00CEC9;
  --bg-main: #F4F7FE;
  --bg-card: #FFFFFF;
  --text-dark: #2D3436;
  --text-muted: #636E72;
  --border-light: #E2E8F0;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --radius-pill: 999px;
  --shadow-color: rgba(108, 92, 231, 0.12);
  --shadow-sm: 0 6px 16px rgba(108, 92, 231, 0.08);
  --shadow-md: 0 12px 32px rgba(108, 92, 231, 0.14);
  --shadow-lg: 0 20px 50px rgba(108, 92, 231, 0.22);
  --shadow-glow-pink: 0 10px 25px rgba(253, 121, 168, 0.4);
  --shadow-glow-purple: 0 10px 25px rgba(108, 92, 231, 0.4);
  --shadow-glow-yellow: 0 10px 25px rgba(253, 203, 110, 0.5);
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(255, 255, 255, 0.8);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Quicksand', 'Plus Jakarta Sans', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: linear-gradient(125deg, #F4F7FE 0%, #F5F3FF 35%, #FFF0F6 70%, #F0F9FF 100%);
  background-size: 250% 250%;
  animation: meshBg 16s ease infinite alternate;
  color: var(--text-dark);
  position: relative;
  min-height: 100vh;
}

@keyframes meshBg {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Animated Kids Background Overlay */
.animated-kids-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-bubble {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.45;
  animation: pulseGlow 12s ease-in-out infinite alternate;
}

.bg-bubble.b1 {
  width: 420px;
  height: 420px;
  background: rgba(253, 203, 110, 0.5);
  top: -100px;
  left: -100px;
  animation-duration: 14s;
}

.bg-bubble.b2 {
  width: 480px;
  height: 480px;
  background: rgba(253, 121, 168, 0.4);
  top: 15%;
  right: -120px;
  animation-duration: 18s;
}

.bg-bubble.b3 {
  width: 420px;
  height: 420px;
  background: rgba(108, 92, 231, 0.32);
  bottom: -100px;
  left: 15%;
  animation-duration: 16s;
}

.bg-bubble.b4 {
  width: 350px;
  height: 350px;
  background: rgba(85, 230, 193, 0.4);
  bottom: 15%;
  right: 12%;
  animation-duration: 13s;
}

@keyframes pulseGlow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.35; }
  50% { transform: scale(1.25) translate(35px, -25px); opacity: 0.6; }
  100% { transform: scale(0.9) translate(-25px, 35px); opacity: 0.35; }
}

/* Floating Elements (Emoji/Icons) */
.bg-shape {
  position: absolute;
  font-size: 34px;
  user-select: none;
  opacity: 0.65;
  filter: drop-shadow(0 8px 16px rgba(108, 92, 231, 0.2));
  animation: floatDrift 10s ease-in-out infinite alternate;
}

.bg-shape.shape-1 { top: 14%; left: 3%; font-size: 44px; animation-duration: 9s; }
.bg-shape.shape-2 { top: 22%; right: 4%; font-size: 38px; animation-duration: 11s; animation-delay: -2s; }
.bg-shape.shape-3 { top: 58%; left: 2.5%; font-size: 42px; animation-duration: 13s; animation-delay: -4s; }
.bg-shape.shape-4 { top: 72%; right: 3.5%; font-size: 46px; animation-duration: 10s; animation-delay: -1s; }
.bg-shape.shape-5 { top: 38%; left: 89%; font-size: 40px; animation-duration: 12s; animation-delay: -5s; }
.bg-shape.shape-6 { top: 86%; left: 24%; font-size: 34px; animation-duration: 8s; animation-delay: -3s; }
.bg-shape.shape-7 { top: 12%; left: 78%; font-size: 38px; animation-duration: 14s; animation-delay: -6s; }
@keyframes floatDrift {
  0% { transform: translateY(0px) rotate(0deg) scale(1); }
  50% { transform: translateY(-28px) rotate(14deg) scale(1.12); }
  100% { transform: translateY(18px) rotate(-12deg) scale(0.92); }
}

.main-wrapper, footer {
  position: relative;
  z-index: 1;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Fredoka', cursive, sans-serif;
  letter-spacing: 0.3px;
}

/* Glassmorphism Navbar with Playful Glow */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 2px solid rgba(108, 92, 231, 0.1);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.08);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Fredoka', cursive;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: scale(1.05) rotate(-1deg);
}

.brand-logo span.badge-v2 {
  background: var(--secondary-gradient);
  color: white;
  font-size: 13px;
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  font-family: 'Fredoka', cursive;
  box-shadow: 0 4px 10px rgba(255, 118, 117, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 15px;
  transition: all 0.25s ease;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
  background: #EFEDFD;
  transform: translateY(-2px);
}

/* Playful Premium Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 800;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  min-height: 50px;
  font-family: 'Fredoka', cursive;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-glow-purple);
}

.btn-primary:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 30px rgba(108, 92, 231, 0.5);
}

.btn-secondary {
  background: var(--secondary-gradient);
  color: white;
  box-shadow: var(--shadow-glow-pink);
}

.btn-secondary:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 30px rgba(253, 121, 168, 0.5);
}

.btn-outline {
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.1);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
}

/* Main Container */
.main-wrapper {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px;
}

/* Category Pills with Colorful Borders & Hover Bounce */
.category-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 10px 4px 20px 4px;
  scrollbar-width: none;
}

.category-scroll::-webkit-scrollbar {
  display: none;
}

.category-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: white;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  font-family: 'Fredoka', cursive;
}

.category-pill:hover, .category-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-glow-purple);
}

/* Template Grid & Cards */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px;
  margin-top: 24px;
}

@media (max-width: 600px) {
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

.template-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 2px solid #F1F5F9;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.template-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: #A29BFE;
}

.template-thumb {
  position: relative;
  width: 100%;
  padding-top: 75%;
  background: linear-gradient(135deg, #FFF9E6 0%, #F5F6FA 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-thumb img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  height: 85%;
  object-fit: contain;
  transition: transform 0.35s ease;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.06));
}

.template-card:hover .template-thumb img {
  transform: translate(-50%, -50%) scale(1.1);
}

.badge-access {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  font-family: 'Fredoka', cursive;
  letter-spacing: 0.5px;
  z-index: 5;
}

.badge-free {
  background: #E3F9E5;
  color: #10B981;
  border: 1px solid #A7F3D0;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.badge-premium {
  background: linear-gradient(135deg, #FFEAA7, #FDCB6E);
  color: #D63031;
  border: 1px solid #FDE68A;
  box-shadow: 0 4px 10px rgba(253, 203, 110, 0.4);
}

.template-info {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.template-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  font-family: 'Fredoka', cursive;
}

.template-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Footer */
footer {
  background: white;
  border-top: 2px solid #F1F5F9;
  padding: 36px 20px;
  margin-top: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  border-radius: var(--radius-md);
  background: #2D3436;
  color: white;
  font-weight: 700;
  font-size: 15px;
  font-family: 'Fredoka', cursive;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-success { background: var(--accent-green-gradient); }
.toast-warning { background: var(--accent-yellow-gradient); color: #2D3436; }
.toast-error { background: var(--secondary-gradient); }

@keyframes slideIn {
  from { transform: translateX(100%) scale(0.8); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

/* Modal Window */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 52, 54, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  transform: translateY(30px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 3px solid #EFEDFD;
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

/* Responsive Global Rules for 100% Mobile Friendly */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

.mobile-user-slot {
  display: none;
}

@media (max-width: 1080px) {
  .navbar {
    padding: 12px 20px;
  }

  .mobile-toggle-btn {
    display: flex !important;
  }

  .desktop-user-slot {
    display: none !important;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: stretch;
    padding: 18px 24px;
    box-shadow: 0 14px 35px rgba(108, 92, 231, 0.15);
    border-bottom: 2px solid rgba(108, 92, 231, 0.15);
    display: none;
    gap: 8px;
    z-index: 1001;
  }

  .nav-links.mobile-active {
    display: flex !important;
    animation: dropdownFade 0.25s ease-out;
  }

  .nav-links a {
    width: 100%;
    text-align: left;
    padding: 12px 18px;
    border-radius: 14px;
    white-space: nowrap;
  }

  .mobile-user-slot {
    display: block !important;
  }

  /* Hero Banner Responsive for Tablet & Mobile */
  .hero-section-box {
    padding: 36px 24px !important;
    margin-bottom: 32px !important;
    border-radius: var(--radius-lg) !important;
  }

  .hero-grid-layout {
    flex-direction: column !important;
    gap: 32px !important;
    text-align: center !important;
    align-items: center !important;
  }

  .hero-text-content {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    align-items: center !important;
  }

  .hero-title-text {
    font-size: 32px !important;
    margin-bottom: 14px !important;
    line-height: 1.3 !important;
  }

  .hero-desc-text {
    font-size: 15px !important;
    margin-bottom: 24px !important;
    max-width: 600px !important;
  }

  .hero-btn-container {
    justify-content: center !important;
    width: 100% !important;
  }

  .hero-preview-box {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 540px !important;
  }

  .hero-preview-img {
    height: 260px !important;
  }

  /* Floating Background Elements */
  .bg-shape {
    opacity: 0.3 !important;
    font-size: 24px !important;
  }

  .main-wrapper {
    padding: 20px 16px !important;
  }

  .section-title-text {
    font-size: 22px !important;
  }

  /* Responsive Footer */
  .footer-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 28px !important;
    text-align: left !important;
  }

  .footer-bottom {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: left !important;
    gap: 12px !important;
  }

  footer {
    padding: 32px 20px 20px 20px !important;
  }
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr !important;
    text-align: center !important;
  }
  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
