/* ==========================================================================
   Janmashtami Personalized Invitation Generator - Premium Styles (English)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&family=Anek+Gujarati:wght@400;600;700;800&family=Hind+Vadodara:wght@400;600;700&family=Noto+Serif+Gujarati:wght@400;600;700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-creme-light: #FFFDF9;
  --bg-creme-warm: #FAF5E9;
  --bg-creme-deep: #F3EBD8;
  
  --gold-100: #FFF6D6;
  --gold-300: #F7D472;
  --gold-500: #D4AF37;
  --gold-600: #B8860B;
  --gold-700: #8C6207;
  --gold-gradient: linear-gradient(135deg, #FDF0CD 0%, #D4AF37 50%, #A67C1E 100%);
  --gold-glow: 0 0 24px rgba(212, 175, 55, 0.45);
  
  --krishna-blue: #0F3057;
  --peacock-teal: #00587A;
  --peacock-dark: #002B36;
  --divine-maroon: #780016;
  --divine-crimson: #9E1A2A;
  --festive-saffron: #E65100;
  
  --text-dark: #1E1B18;
  --text-muted: #665D52;
  --text-light: #FBF8F2;
  
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(212, 175, 55, 0.4);
  --glass-shadow: 0 16px 40px -10px rgba(120, 0, 22, 0.08), 0 8px 24px -6px rgba(0, 0, 0, 0.06);
  
  /* Typography */
  --font-heading: 'Cinzel', 'Outfit', serif;
  --font-body: 'Outfit', 'Poppins', sans-serif;
  --font-gujarati: 'Anek Gujarati', 'Hind Vadodara', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-creme-warm);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(212, 175, 55, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(158, 26, 42, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(0, 88, 122, 0.05) 0%, transparent 60%);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Decorative Background Elements */
.bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-feather {
  position: absolute;
  width: 180px;
  height: 180px;
  opacity: 0.06;
  background-size: contain;
  background-repeat: no-repeat;
}

.bg-feather-1 {
  top: -30px;
  right: -30px;
  transform: rotate(25deg);
}

.bg-feather-2 {
  bottom: 5%;
  left: -40px;
  transform: rotate(-35deg);
}

/* Main Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1rem 3.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Festive Brand */
.festive-header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.festive-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.35rem;
  background: var(--gold-gradient);
  color: var(--peacock-dark);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.festive-badge svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: currentColor;
}

.app-title {
  font-family: var(--font-heading);
  font-size: 2.35rem;
  font-weight: 800;
  color: var(--divine-maroon);
  line-height: 1.2;
  margin-bottom: 0.45rem;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(120, 0, 22, 0.1);
}

.app-subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 560px;
  margin: 0 auto;
}

.diya-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.25rem auto 0;
  max-width: 280px;
}

.diya-divider::before,
.diya-divider::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
}

.diya-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--gold-600);
}

/* Page View Containers */
.page-view {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.page-view.active {
  display: block;
}

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

/* Card Styles */
.festive-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.festive-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gold-gradient);
}

.card-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--peacock-dark);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.card-heading svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--gold-600);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.75rem;
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--peacock-dark);
  margin-bottom: 0.4rem;
}

.form-label .required {
  color: var(--divine-crimson);
  margin-left: 3px;
}

.label-hint {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.2rem;
}

.input-wrapper {
  position: relative;
}

.form-input {
  width: 100%;
  padding: 0.85rem 1.15rem 0.85rem 2.75rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-dark);
  background: #FFFDF9;
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus {
  border-color: var(--gold-500);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.form-input::placeholder {
  color: #A99E91;
}

.input-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--gold-600);
  pointer-events: none;
}

.input-clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
}

.form-input:not(:placeholder-shown) ~ .input-clear-btn {
  display: flex;
}

.input-clear-btn:hover {
  color: var(--divine-crimson);
}

/* Photo Upload Box */
.photo-upload-zone {
  border: 2px dashed rgba(212, 175, 55, 0.6);
  background: rgba(254, 250, 240, 0.6);
  border-radius: var(--radius-md);
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
}

.photo-upload-zone:hover,
.photo-upload-zone.dragover {
  border-color: var(--gold-600);
  background: rgba(254, 246, 225, 0.95);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.2);
}

.photo-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.upload-icon-circle {
  width: 54px;
  height: 54px;
  margin: 0 auto 0.75rem;
  background: var(--gold-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--peacock-dark);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.35);
  transition: var(--transition-bounce);
}

.upload-icon-circle svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.photo-upload-zone:hover .upload-icon-circle {
  transform: scale(1.08);
}

.upload-prompt {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--peacock-dark);
  margin-bottom: 0.25rem;
}

.upload-types {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Photo Crop / Adjuster Box */
.photo-crop-container {
  display: none;
  background: #FFFDF9;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.crop-preview-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.crop-preview-frame {
  width: 145px;
  height: 145px;
  border-radius: 24px;
  border: 3.5px solid var(--gold-500);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.4);
  overflow: hidden;
  position: relative;
  background: #222;
  flex-shrink: 0;
  cursor: grab;
}

.crop-preview-frame:active {
  cursor: grabbing;
}

.crop-preview-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  user-select: none;
  pointer-events: none;
}

.crop-controls {
  flex: 1;
  min-width: 200px;
}

.control-row {
  margin-bottom: 0.75rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--peacock-dark);
  margin-bottom: 0.25rem;
}

.slider-input {
  width: 100%;
  accent-color: var(--gold-600);
  cursor: pointer;
}

.crop-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-small {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: #FFF;
  color: var(--text-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-smooth);
}

.btn-small svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-small:hover {
  background: var(--bg-creme-warm);
  border-color: var(--gold-500);
}

.btn-small.danger {
  color: var(--divine-crimson);
}

.btn-small.danger:hover {
  background: #FFF0F2;
  border-color: var(--divine-crimson);
}

/* Form Actions / Primary Buttons */
.form-actions {
  margin-top: 2rem;
}

.btn-primary {
  width: 100%;
  padding: 0.95rem 1.75rem;
  background: linear-gradient(135deg, #B8860B 0%, #D4AF37 50%, #9E1A2A 100%);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(158, 26, 42, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.btn-primary svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn-primary:hover:not(:disabled)::before {
  transform: translateX(100%);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(158, 26, 42, 0.35), var(--gold-glow);
}

.btn-primary:hover:not(:disabled) svg {
  transform: translateX(4px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Secondary Button */
.btn-secondary {
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: #FFFDF9;
  border: 1.5px solid var(--card-border);
  color: var(--peacock-dark);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: var(--transition-smooth);
}

.btn-secondary svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex-shrink: 0;
}

.btn-secondary:hover {
  background: var(--bg-creme-warm);
  border-color: var(--gold-500);
  transform: translateY(-1px);
}

/* ==========================================================================
   Page 2 — Actions & Button Grid (Fixed icon scaling & balanced layout)
   ========================================================================== */
.preview-actions-bar {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.action-row-main {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  align-items: stretch;
}

.action-row-secondary {
  display: flex;
  width: 100%;
}

/* Download Button */
.btn-download {
  flex: 1;
  background: linear-gradient(135deg, #00587A 0%, #0F3057 100%);
  color: #FFF;
  border: none;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 8px 24px rgba(15, 48, 87, 0.25);
  transition: var(--transition-bounce);
  min-height: 48px;
  text-decoration: none;
}

.btn-download svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 48, 87, 0.35), 0 0 15px rgba(0, 88, 122, 0.3);
}

/* WhatsApp Share Button */
.btn-share {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #FFF;
  border: none;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.25);
  transition: var(--transition-bounce);
  min-height: 48px;
}

.btn-share svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  flex-shrink: 0;
}

.btn-share:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(37, 211, 102, 0.35);
}

/* Page 2 — Invitation Preview Layout */
.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.preview-container {
  width: 100%;
  max-width: 480px;
  background: #FAF5E9;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(212, 175, 55, 0.4);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.preview-canvas {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  border-radius: inherit;
}

/* Loading Overlay */
.preview-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 253, 249, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.preview-loading.active {
  opacity: 1;
  pointer-events: auto;
}

.festive-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(212, 175, 55, 0.2);
  border-top-color: var(--gold-500);
  border-right-color: var(--divine-crimson);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--peacock-dark);
}

/* Customization Options Bar */
.tweak-panel {
  width: 100%;
  max-width: 500px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.tweak-header {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--peacock-dark);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tweak-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.tweak-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  background: #FFFDF9;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  outline: none;
}

.tweak-select:focus {
  border-color: var(--gold-500);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--peacock-dark);
  color: #FFF;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.3s ease-out forwards;
  border: 1px solid var(--gold-500);
}

.toast.success {
  background: #0B4F35;
  border-color: #34D399;
}

.toast.error {
  background: var(--divine-maroon);
  border-color: #F87171;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Footer */
.app-footer {
  text-align: center;
  margin-top: auto;
  padding-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.footer-festive-quote {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--divine-maroon);
  margin-bottom: 0.25rem;
  letter-spacing: 0.5px;
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .app-container {
    padding: 1.25rem 0.75rem 2.5rem;
  }
  
  .app-title {
    font-size: 1.85rem;
  }

  .festive-card {
    padding: 1.5rem 1.25rem;
    border-radius: var(--radius-md);
  }

  .crop-preview-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .crop-preview-frame {
    margin: 0 auto;
  }

  .action-row-main {
    flex-direction: column;
  }

  .btn-download,
  .btn-share,
  .btn-secondary {
    width: 100%;
  }
}
