/**
 * EcrioX Diwali Wishes Maker - Premium Festive Theme
 * Deep midnight black & radiant gold aesthetic, responsive canvas workspace,
 * glowing diyas, and mobile-first touch controls.
 */

:root {
  --diwali-bg-deep: #08050e;
  --diwali-bg-surface: #120b1e;
  --diwali-bg-card: #190f2b;
  --diwali-gold: #ffd700;
  --diwali-gold-dark: #b8860b;
  --diwali-gold-glow: rgba(255, 215, 0, 0.35);
  --diwali-amber: #ff9f1a;
  --diwali-crimson: #c2410c;
  --diwali-text-light: #fffdf5;
  --diwali-text-muted: #d1c4e9;
  --diwali-border: rgba(255, 215, 0, 0.22);
  --diwali-radius-lg: 16px;
  --diwali-radius-md: 10px;
}

body.diwali-page {
  background-color: var(--diwali-bg-deep);
  color: var(--diwali-text-light);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

/* Typography Accents */
.text-gold {
  color: var(--diwali-gold) !important;
}
.font-festive {
  font-family: 'Cinzel', 'Playfair Display', Georgia, serif;
}

/* ==========================================================================
   1. HERO SECTION & FLOATING DECORATIONS
   ========================================================================== */
.diwali-hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  background: radial-gradient(circle at 50% 20%, #2a1147 0%, var(--diwali-bg-deep) 75%);
  overflow: hidden;
}

.hero-particles-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(255, 215, 0, 0.15) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  opacity: 0.6;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
  margin: 0 auto;
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid var(--diwali-border);
  color: var(--diwali-gold);
  padding: 0.45rem 1.2rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.15);
}

.hero-main-title {
  font-family: 'Cinzel', 'Playfair Display', Georgia, serif;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  font-weight: 800;
  line-height: 1.15;
  color: #ffffff;
  margin-bottom: 1.25rem;
  text-shadow: 0 4px 25px rgba(255, 215, 0, 0.3);
}

.hero-main-title .gold-gradient-text {
  background: linear-gradient(135deg, #fff7c2 0%, #ffd700 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle-text {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  color: var(--diwali-text-muted);
  max-width: 680px;
  margin: 0 auto 2.25rem;
  line-height: 1.6;
}

.hero-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.btn-diwali-primary {
  background: linear-gradient(135deg, #ffd700, #f59e0b);
  color: #0b0514;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 1rem 2rem;
  border-radius: 9999px;
  border: none;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.btn-diwali-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(255, 215, 0, 0.6);
  color: #000000;
}

.btn-diwali-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--diwali-border);
  color: var(--diwali-gold);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 1rem 1.8rem;
  border-radius: 9999px;
  transition: all 0.25s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-diwali-outline:hover {
  background: rgba(255, 215, 0, 0.12);
  border-color: var(--diwali-gold);
}

/* ==========================================================================
   2. FESTIVE COUNTDOWN TIMER
   ========================================================================== */
.countdown-section-wrapper {
  background: var(--diwali-bg-surface);
  border-top: 1px solid var(--diwali-border);
  border-bottom: 1px solid var(--diwali-border);
  padding: 2.5rem 1rem;
  text-align: center;
}
.countdown-tiles-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}
.countdown-tile {
  background: var(--diwali-bg-card);
  border: 1px solid var(--diwali-border);
  border-radius: var(--diwali-radius-md);
  padding: 1rem 1.5rem;
  min-width: 90px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.countdown-num {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--diwali-gold);
  display: block;
  line-height: 1;
  margin-bottom: 0.35rem;
}
.countdown-lbl {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--diwali-text-muted);
}

/* ==========================================================================
   3. CARD CREATOR WORKSPACE
   ========================================================================== */
.creator-workspace-container {
  max-width: 1200px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

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

/* Form Panel */
.creator-form-panel {
  background: var(--diwali-bg-surface);
  border: 1px solid var(--diwali-border);
  border-radius: var(--diwali-radius-lg);
  padding: 2rem;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.form-group-block {
  margin-bottom: 1.5rem;
}
.form-group-block label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--diwali-gold);
  margin-bottom: 0.5rem;
}

.diwali-input, .diwali-select, .diwali-textarea {
  width: 100%;
  background: var(--diwali-bg-card);
  border: 1.5px solid var(--diwali-border);
  border-radius: var(--diwali-radius-md);
  padding: 0.85rem 1.1rem;
  color: #ffffff;
  font-size: 1rem;
  transition: all 0.2s ease;
}
.diwali-input:focus, .diwali-select:focus, .diwali-textarea:focus {
  outline: none;
  border-color: var(--diwali-gold);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}

.controls-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Format Pills */
.format-buttons-row {
  display: flex;
  gap: 0.5rem;
  background: var(--diwali-bg-card);
  padding: 0.35rem;
  border-radius: 9999px;
  border: 1px solid var(--diwali-border);
}
.format-btn {
  flex: 1;
  padding: 0.55rem 0.85rem;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--diwali-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.format-btn.active {
  background: var(--diwali-gold);
  color: #08050e;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* Color Swatches */
.color-swatches-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.color-swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.color-swatch-btn:hover {
  transform: scale(1.15);
}
.color-swatch-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 8px #ffffff;
}

/* Alignment Buttons */
.align-buttons-group {
  display: flex;
  gap: 0.4rem;
}
.align-btn {
  padding: 0.55rem 0.9rem;
  background: var(--diwali-bg-card);
  border: 1px solid var(--diwali-border);
  color: var(--diwali-text-muted);
  border-radius: var(--diwali-radius-md);
  cursor: pointer;
  font-size: 0.9rem;
}
.align-btn.active {
  background: var(--diwali-gold);
  color: #08050e;
}

/* Photo Upload Box */
.photo-upload-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.custom-file-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 215, 0, 0.1);
  border: 1px dashed var(--diwali-gold);
  color: var(--diwali-gold);
  padding: 0.65rem 1.25rem;
  border-radius: var(--diwali-radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s ease;
}
.custom-file-upload:hover {
  background: rgba(255, 215, 0, 0.2);
}
.btn-remove-photo {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.65rem 1rem;
  border-radius: var(--diwali-radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: none;
}

/* Live Canvas Preview Panel (Sticky) */
.canvas-preview-panel {
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-wrapper {
  width: 100%;
  max-width: 480px;
  background: #000000;
  border: 2px solid var(--diwali-border);
  border-radius: var(--diwali-radius-lg);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 215, 0, 0.15);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: max-width 0.3s ease;
}
.canvas-wrapper.format-story {
  max-width: 360px;
}
.canvas-wrapper.format-portrait {
  max-width: 420px;
}

#cardCanvas {
  width: 100%;
  height: auto;
  display: block;
}

/* Action Share Bar */
.action-share-bar {
  width: 100%;
  max-width: 480px;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-whatsapp-viral {
  background: #25d366;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 1.1rem 1.5rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.35);
  transition: all 0.25s ease;
  width: 100%;
}
.btn-whatsapp-viral:hover {
  background: #1ebe5d;
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(37, 211, 102, 0.5);
}

.download-split-buttons {
  display: flex;
  gap: 0.6rem;
}
.btn-download-hd {
  flex: 1;
  background: linear-gradient(135deg, #ffd700, #f59e0b);
  color: #0b0514;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: var(--diwali-radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.btn-download-hd:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

/* ==========================================================================
   4. TEMPLATE GALLERY
   ========================================================================== */
.templates-gallery-section {
  max-width: 1200px;
  margin: 4rem auto;
  padding: 0 1rem;
}

.category-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.75rem 0 2.5rem;
}
.cat-pill {
  background: var(--diwali-bg-card);
  border: 1px solid var(--diwali-border);
  color: var(--diwali-text-muted);
  padding: 0.55rem 1.25rem;
  border-radius: 9999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--diwali-gold);
  color: #08050e;
  border-color: var(--diwali-gold);
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.25rem;
}

.template-card {
  background: var(--diwali-bg-surface);
  border: 1.5px solid var(--diwali-border);
  border-radius: var(--diwali-radius-md);
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.template-card:hover {
  transform: translateY(-4px);
  border-color: var(--diwali-gold);
  box-shadow: 0 8px 24px rgba(255, 215, 0, 0.2);
}
.template-card.active {
  border-color: var(--diwali-gold);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}

.template-preview-box {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.mini-diya-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}
.template-preview-text {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Cinzel', serif;
}
.template-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}
.template-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
}
.template-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 215, 0, 0.15);
  color: var(--diwali-gold);
  font-weight: 700;
}

/* ==========================================================================
   5. SMART WISH GENERATOR SECTION
   ========================================================================== */
.smart-wishes-section {
  background: var(--diwali-bg-surface);
  border-top: 1px solid var(--diwali-border);
  border-bottom: 1px solid var(--diwali-border);
  padding: 4rem 1.5rem;
}
.smart-wishes-container {
  max-width: 960px;
  margin: 0 auto;
}

.generator-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin: 2rem 0;
}
.generator-control-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.smart-wishes-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.wish-item-card {
  background: var(--diwali-bg-card);
  border: 1px solid var(--diwali-border);
  border-radius: var(--diwali-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}
.wish-item-card:hover {
  border-color: var(--diwali-gold);
}
.wish-item-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--diwali-text-muted);
  margin-bottom: 1rem;
}
.btn-outline-gold {
  background: transparent;
  border: 1px solid var(--diwali-gold);
  color: var(--diwali-gold);
  padding: 0.45rem 0.85rem;
  border-radius: var(--diwali-radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s ease;
}
.btn-outline-gold:hover {
  background: var(--diwali-gold);
  color: #08050e;
}

/* ==========================================================================
   6. INTERACTIVE "PASS THE LIGHT" WIDGET
   ========================================================================== */
.pass-the-light-section {
  max-width: 800px;
  margin: 4.5rem auto;
  text-align: center;
  padding: 0 1.5rem;
}
.interactive-diya-box {
  width: 140px;
  height: 140px;
  margin: 1.5rem auto;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--diwali-bg-surface);
  border: 2px dashed var(--diwali-border);
  border-radius: 50%;
  transition: all 0.3s ease;
}
.interactive-diya-box:hover {
  transform: scale(1.08);
  border-color: var(--diwali-gold);
}
.interactive-diya-box.is-lit {
  border-style: solid;
  border-color: var(--diwali-gold);
  box-shadow: 0 0 45px rgba(255, 215, 0, 0.5);
}
.diya-flame-icon {
  font-size: 3.5rem;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.4));
  transition: transform 0.2s ease;
}
.interactive-diya-box.is-lit .diya-flame-icon {
  animation: diyaFlicker 1.5s infinite alternate ease-in-out;
}

@keyframes diyaFlicker {
  0% { transform: scale(1) translateY(0); filter: drop-shadow(0 0 15px #ffd700); }
  50% { transform: scale(1.1) translateY(-2px); filter: drop-shadow(0 0 25px #ff9f1a); }
  100% { transform: scale(1.05) translateY(1px); filter: drop-shadow(0 0 20px #ffd700); }
}

.confetti-spark {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  pointer-events: none;
  z-index: 9999;
  animation: sparkBurst 1.2s forwards cubic-bezier(0.12, 0.8, 0.32, 1);
}

@keyframes sparkBurst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* Post Download Banner */
.post-download-banner {
  display: none;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(245, 158, 11, 0.2));
  border: 1.5px solid var(--diwali-gold);
  border-radius: var(--diwali-radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
  text-align: center;
}

/* FAQ Section */
.faq-accordion {
  margin-top: 2rem;
}
.faq-item {
  background: var(--diwali-bg-card);
  border: 1px solid var(--diwali-border);
  border-radius: var(--diwali-radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.faq-question {
  padding: 1.1rem 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
}
.faq-question:hover {
  background: rgba(255, 215, 0, 0.05);
}
.faq-answer {
  padding: 0 1.4rem 1.2rem;
  color: var(--diwali-text-muted);
  line-height: 1.6;
  display: none;
}
.faq-item.open .faq-answer {
  display: block;
}
.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

/* Mobile Sticky Share Bar */
@media (max-width: 768px) {
  .canvas-preview-panel {
    position: static;
    margin-bottom: 2rem;
  }
}
