/* ============================================
   Eleanore's Magical World - Shared Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Quicksand:wght@400;500;600;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --purple: #7B2FBE;
  --purple-dark: #4A148C;
  --purple-light: #BB86FC;
  --pink: #E91E8C;
  --pink-light: #F8BBD0;
  --blue: #4FC3F7;
  --blue-dark: #0288D1;
  --lavender: #E8DAF5;
  --gold: #FFD54F;
  --mint: #80CBC4;
  --coral: #FF8A80;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 40%, #f093fb 100%);
  --card-bg: rgba(255, 255, 255, 0.15);
  --card-bg-solid: rgba(255, 255, 255, 0.92);
  --glow-purple: 0 0 20px rgba(123, 47, 190, 0.4);
  --glow-pink: 0 0 20px rgba(233, 30, 140, 0.4);
  --radius: 16px;
  --radius-lg: 24px;
  --font-heading: 'Fredoka', sans-serif;
  --font-body: 'Quicksand', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 500;
  color: #2d1654;
  min-height: 100vh;
  background: var(--bg-gradient);
  background-attachment: fixed;
  overflow-x: hidden;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
}

/* ---------- Particles Container ---------- */
#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  pointer-events: none;
  animation: floatUp linear infinite;
  opacity: 0.7;
  font-size: 1.2rem;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 0.7;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    transform: translateY(-10vh) rotate(360deg) scale(1);
    opacity: 0;
  }
}

/* ---------- Navigation ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: rgba(74, 20, 140, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 3px solid var(--pink);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.3s;
}

.nav-logo:hover {
  transform: scale(1.05);
}

.nav-logo .dragon-icon {
  font-size: 1.8rem;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  list-style: none;
}

.nav-links a {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: 50px;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: rgba(255,255,255,0.1);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--pink);
  transform: translateY(-2px);
  box-shadow: var(--glow-pink);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ---------- Page Container ---------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: calc(100vh - 60px);
}

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg-solid);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 2px solid rgba(123, 47, 190, 0.15);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(123, 47, 190, 0.2);
}

.card-magical {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,187,208,0.3));
  border: 2px solid var(--purple-light);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.btn:hover::after {
  width: 300px;
  height: 300px;
}

.btn:active {
  transform: scale(0.95);
}

.btn-purple {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  box-shadow: 0 4px 15px rgba(123, 47, 190, 0.4);
}

.btn-purple:hover {
  box-shadow: 0 6px 25px rgba(123, 47, 190, 0.6);
  transform: translateY(-2px);
}

.btn-pink {
  background: linear-gradient(135deg, var(--pink), #c2185b);
  box-shadow: 0 4px 15px rgba(233, 30, 140, 0.4);
}

.btn-pink:hover {
  box-shadow: 0 6px 25px rgba(233, 30, 140, 0.6);
  transform: translateY(-2px);
}

.btn-blue {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  box-shadow: 0 4px 15px rgba(79, 195, 247, 0.4);
}

.btn-blue:hover {
  box-shadow: 0 6px 25px rgba(79, 195, 247, 0.6);
  transform: translateY(-2px);
}

/* ---------- Section Titles ---------- */
.section-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--purple-dark);
  position: relative;
}

.section-title::after {
  content: '✨';
  margin-left: 0.5rem;
}

.section-title::before {
  content: '✨';
  margin-right: 0.5rem;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 2rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

.footer .dragon-footer {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---------- Gallery Styles ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 1;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 4px solid var(--purple-light);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.gallery-item:hover {
  transform: scale(1.03) rotate(1deg);
  box-shadow: 0 8px 30px rgba(123, 47, 190, 0.3);
  border-color: var(--pink);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(transparent, rgba(74, 20, 140, 0.85));
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-caption {
  transform: translateY(0);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn 0.3s ease;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
  border: 4px solid white;
  box-shadow: 0 0 60px rgba(123, 47, 190, 0.5);
  animation: zoomIn 0.3s ease;
}

.lightbox-caption {
  position: absolute;
  bottom: 2rem;
  color: white;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  transition: transform 0.3s;
  background: none;
  border: none;
  line-height: 1;
}

.lightbox-close:hover {
  transform: rotate(90deg) scale(1.2);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Drawing App Styles ---------- */
.draw-container {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.canvas-wrapper {
  flex: 1;
  background: white;
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 4px solid var(--purple-light);
  position: relative;
  overflow: hidden;
}

.canvas-wrapper canvas {
  display: block;
  width: 100%;
  border-radius: calc(var(--radius-lg) - 6px);
  cursor: crosshair;
}

.toolbar {
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-shrink: 0;
}

.tool-section {
  background: var(--card-bg-solid);
  border-radius: var(--radius);
  padding: 1rem;
  border: 2px solid rgba(123, 47, 190, 0.15);
}

.tool-section h3 {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--purple-dark);
  margin-bottom: 0.75rem;
  text-align: center;
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.tool-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--lavender);
  transition: all 0.2s ease;
  border: 2px solid transparent;
  color: var(--purple-dark);
}

.tool-btn:hover {
  background: var(--pink-light);
  transform: scale(1.1);
}

.tool-btn.active {
  background: var(--purple);
  color: white;
  border-color: var(--pink);
  box-shadow: var(--glow-purple);
  transform: scale(1.05);
}

/* Color palette */
.color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
  position: relative;
}

.color-btn:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.color-btn.active {
  border-color: var(--purple-dark);
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--purple-light);
}

/* Size buttons */
.size-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lavender);
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.size-btn:hover {
  background: var(--pink-light);
  transform: scale(1.1);
}

.size-btn.active {
  background: var(--purple);
  border-color: var(--pink);
  box-shadow: var(--glow-purple);
}

.size-dot {
  border-radius: 50%;
  background: var(--purple-dark);
}

.size-btn.active .size-dot {
  background: white;
}

/* Action buttons in drawing */
.action-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.action-btns .btn {
  justify-content: center;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  width: 100%;
}

/* Stamp buttons */
.stamp-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--lavender);
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.stamp-btn:hover {
  background: var(--pink-light);
  transform: scale(1.15);
}

.stamp-btn.active {
  background: var(--purple);
  border-color: var(--pink);
  box-shadow: var(--glow-purple);
}

/* ---------- Landing Page Specific ---------- */
.hero {
  text-align: center;
  padding: 3rem 1rem;
  position: relative;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #f8bbd0 30%, #ce93d8 60%, #90caf9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease-in-out infinite alternate;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  text-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

@keyframes shimmer {
  0% { filter: drop-shadow(0 0 10px rgba(206,147,216,0.3)) hue-rotate(0deg); }
  100% { filter: drop-shadow(0 0 20px rgba(233,30,140,0.4)) hue-rotate(15deg); }
}

.hero-subtitle {
  font-size: 1.3rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  margin-bottom: 2rem;
}

.hero-dragon {
  font-size: 5rem;
  display: block;
  margin: 1rem auto;
  animation: dragonFly 4s ease-in-out infinite;
}

@keyframes dragonFly {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-15px) rotate(-3deg); }
  50% { transform: translateY(-5px) rotate(0deg); }
  75% { transform: translateY(-20px) rotate(3deg); }
}

.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.nav-card {
  background: var(--card-bg-solid);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all 0.4s ease;
  border: 3px solid rgba(123, 47, 190, 0.15);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.nav-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(123,47,190,0.05), rgba(233,30,140,0.05));
  opacity: 0;
  transition: opacity 0.4s;
}

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

.nav-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--pink);
  box-shadow: 0 16px 48px rgba(123, 47, 190, 0.25);
}

.nav-card-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
  transition: transform 0.4s ease;
}

.nav-card:hover .nav-card-icon {
  transform: scale(1.2) rotate(5deg);
  animation: jiggle 0.5s ease;
}

@keyframes jiggle {
  0%, 100% { transform: scale(1.2) rotate(5deg); }
  25% { transform: scale(1.25) rotate(-3deg); }
  50% { transform: scale(1.15) rotate(7deg); }
  75% { transform: scale(1.22) rotate(-2deg); }
}

.nav-card h3 {
  font-size: 1.5rem;
  color: var(--purple-dark);
  margin-bottom: 0.5rem;
}

.nav-card p {
  color: #666;
  font-size: 0.95rem;
}

/* Countdown section */
.countdowns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.countdown-card {
  background: var(--card-bg-solid);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  border: 2px solid rgba(123, 47, 190, 0.1);
  transition: all 0.3s ease;
}

.countdown-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.countdown-emoji {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.countdown-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--purple-dark);
  margin-bottom: 0.5rem;
}

.countdown-time {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--pink);
  font-weight: 600;
}

/* Audio section */
.audio-section {
  margin: 2rem 0;
}

.audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.audio-card {
  background: var(--card-bg-solid);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 2px solid rgba(123, 47, 190, 0.1);
  transition: all 0.3s ease;
}

.audio-card:hover {
  border-color: var(--purple-light);
  transform: translateY(-2px);
}

.audio-emoji {
  font-size: 2rem;
  flex-shrink: 0;
}

.audio-card audio {
  width: 100%;
  height: 36px;
}

/* Gallery page header area */
.gallery-header {
  text-align: center;
  margin-bottom: 2rem;
}

.gallery-header p {
  color: rgba(255,255,255,0.85);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto;
}

.add-photos-info {
  background: var(--card-bg-solid);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
  border: 2px dashed var(--purple-light);
  text-align: center;
}

.add-photos-info code {
  background: var(--lavender);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--purple-dark);
}

/* Drawing page header */
.draw-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .navbar {
    padding: 0.6rem 1rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(74, 20, 140, 0.95);
    padding: 1rem;
    gap: 0.5rem;
    border-bottom: 3px solid var(--pink);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    text-align: center;
    padding: 0.75rem;
  }

  .nav-toggle {
    display: block;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-dragon {
    font-size: 3.5rem;
  }

  .page {
    padding: 1rem;
  }

  .draw-container {
    flex-direction: column-reverse;
  }

  .toolbar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .tool-section {
    flex: 1;
    min-width: 140px;
  }

  .action-btns {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .action-btns .btn {
    flex: 1;
    min-width: 100px;
  }

  .section-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .nav-card {
    padding: 1.25rem;
  }

  .nav-card-icon {
    font-size: 2.5rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }
}
