/* ==========================================================================
   MANDIRI 88 - CERITA PENGALAMAN PELANGGAN
   Theme: Ceria, Modern, Mobile-First, Empati Dinamis
   v2.0 – Full UI Enhancements: Particles, Progress Steps, Dynamic Theme,
           Submit States, Enhanced Modal, Slide Animations
   ========================================================================== */

:root {
  /* Brand Colors */
  --m88-navy: #0A2540;
  --m88-navy-dark: #061726;
  --m88-navy-light: #163E66;
  --m88-red: #E60000;
  --m88-red-dark: #B80000;
  --m88-red-glow: rgba(230, 0, 0, 0.25);

  /* Cheerful Color Palette */
  --sunny-yellow: #FFB703;
  --sunny-yellow-light: #FFF8E1;
  --joy-orange: #FB8500;
  --joy-pink: #FF4D6D;
  --fresh-emerald: #06D6A0;
  --fresh-emerald-light: #E8F9F3;
  --calm-sky: #219EBC;
  --calm-sky-light: #E1F4F9;

  /* Neutral & Surfaces */
  --bg-page: #FFFDF9;
  --card-bg: #FFFFFF;
  --border-color: #EDE8E3;
  --text-main: #1D2A3A;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Elevation Shadows */
  --shadow-sm: 0 2px 8px rgba(10, 37, 64, 0.05);
  --shadow-md: 0 8px 24px rgba(10, 37, 64, 0.08);
  --shadow-lg: 0 16px 36px rgba(10, 37, 64, 0.12);
  --shadow-colored: 0 10px 25px rgba(230, 0, 0, 0.18);

  /* Border Radii */
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-smooth: 0.3s ease;

  /* Dynamic Theme (overridden by JS theme classes) */
  --theme-accent: #E60000;
  --theme-accent-soft: rgba(230, 0, 0, 0.08);
  --theme-header-from: #FFF9F3;
  --theme-header-to: #FFF2E8;
  --theme-bg-from: #FFF9F2;
  --theme-bg-mid: #F0F6FF;
  --theme-bg-to: #F5FFF8;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--theme-bg-from) 0%, var(--theme-bg-mid) 50%, var(--theme-bg-to) 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  position: relative;
  overflow-x: hidden;
  transition: background 0.6s ease;
}

/* ==========================================================================
   DYNAMIC THEME CLASSES (applied to body by JS)
   ========================================================================== */

body.theme-low {
  --theme-bg-from: #FFF5F5;
  --theme-bg-mid: #FFF0F0;
  --theme-bg-to: #FFF8F8;
  --theme-accent: #E60000;
  --theme-accent-soft: rgba(230, 0, 0, 0.08);
  --theme-header-from: #FFF5F5;
  --theme-header-to: #FFE8E8;
}

body.theme-mid {
  --theme-bg-from: #FFFBF0;
  --theme-bg-mid: #FFF8E1;
  --theme-bg-to: #FFFFF0;
  --theme-accent: #D48806;
  --theme-accent-soft: rgba(212, 136, 6, 0.1);
  --theme-header-from: #FFFBF0;
  --theme-header-to: #FFF3CD;
}

body.theme-high {
  --theme-bg-from: #F0FFF8;
  --theme-bg-mid: #E8F9F3;
  --theme-bg-to: #F0FFFC;
  --theme-accent: #06A87A;
  --theme-accent-soft: rgba(6, 168, 122, 0.08);
  --theme-header-from: #F0FFF8;
  --theme-header-to: #D0F5E8;
}

/* ==========================================================================
   DECORATIVE BACKGROUND SHAPES
   ========================================================================== */

.bg-shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  z-index: 0;
  opacity: 0.45;
  pointer-events: none;
  transition: background 0.6s ease;
}

.shape-1 {
  top: -80px;
  right: -60px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255, 183, 3, 0.8), rgba(251, 133, 0, 0.4));
  animation: floatShape 8s ease-in-out infinite alternate;
}

.shape-2 {
  top: 35%;
  left: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(230, 0, 0, 0.5), rgba(255, 77, 109, 0.3));
  animation: floatShape 10s ease-in-out infinite alternate-reverse;
}

.shape-3 {
  bottom: 50px;
  right: -50px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(6, 214, 160, 0.5), rgba(33, 158, 188, 0.3));
  animation: floatShape 9s ease-in-out infinite alternate;
}

/* Theme-aware blob colors */
body.theme-low .shape-2 {
  background: radial-gradient(circle, rgba(230, 0, 0, 0.7), rgba(255, 77, 109, 0.5));
}
body.theme-mid .shape-1 {
  background: radial-gradient(circle, rgba(255, 183, 3, 1), rgba(251, 133, 0, 0.7));
}
body.theme-high .shape-3 {
  background: radial-gradient(circle, rgba(6, 214, 160, 0.8), rgba(33, 158, 188, 0.5));
}

@keyframes floatShape {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(25px) rotate(15deg); }
}

/* ==========================================================================
   PARTICLE CONTAINER (for star burst particles)
   ========================================================================== */

.particle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.star-particle {
  position: absolute;
  font-size: 16px;
  pointer-events: none;
  user-select: none;
  animation: particleBurst var(--dur, 0.8s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  60% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx, 40px), var(--ty, -60px)) scale(0.2) rotate(var(--rot, 180deg));
  }
}

/* ==========================================================================
   APP CONTAINER (MOBILE-FIRST FRAME)
   ========================================================================== */

.app-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: #FFFFFF;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
}

@media (min-width: 520px) {
  body {
    padding: 24px 16px 48px;
  }
  .app-wrapper {
    min-height: auto;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(230, 0, 0, 0.08);
    overflow: hidden;
  }
}

/* ==========================================================================
   HEADER & BRANDING
   ========================================================================== */

/* Top Rainbow Brand Accent Bar */
.header-accent-bar {
  height: 5px;
  width: 100%;
  background: linear-gradient(90deg, #E60000 0%, #FB8500 24%, #FFB703 48%, #06D6A0 74%, #219EBC 100%);
  flex-shrink: 0;
}

.app-header {
  padding: 16px 16px 14px;
  background: linear-gradient(180deg, var(--theme-header-from) 0%, var(--theme-header-to) 100%);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  position: relative;
  transition: background 0.6s ease;
}

.brand-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

.brand-logo {
  max-height: 88px;
  width: auto;
  max-width: 85%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(10, 37, 64, 0.1));
  transition: transform var(--transition-fast);
}

.brand-logo:hover {
  transform: scale(1.04);
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #FFF0EB 0%, #FFE4D6 100%);
  border: 1px solid #FFCEBE;
  color: #C2410C;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(230, 0, 0, 0.06);
}

.header-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--m88-navy);
  letter-spacing: -0.4px;
  line-height: 1.25;
  margin-bottom: 5px;
}

.header-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 92%;
  margin: 0 auto;
}

/* ==========================================================================
   PROGRESS STEPS (Vibrant Pastel & Engaging)
   ========================================================================== */

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px 10px;
  gap: 0;
  background: linear-gradient(180deg, #FFFDFB 0%, #FAF7F2 100%);
  border-bottom: 1px solid #F0ECE4;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  transition: all 0.4s ease;
}

.step-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #F1F4F9;
  border: 2px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.step-icon {
  transition: all 0.3s ease;
  line-height: 1;
}

.step-check {
  position: absolute;
  width: 20px;
  height: 20px;
  fill: #FFFFFF;
  transition: all 0.3s ease;
}

.step-check.hidden {
  display: none;
}

.step-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.3px;
  transition: color 0.3s ease;
  white-space: nowrap;
}

/* Step 1: Rating (Active by default) */
#stepRating.step-active .step-dot {
  background: linear-gradient(135deg, #E60000 0%, #FF3366 100%);
  border-color: #E60000;
  box-shadow: 0 4px 14px rgba(230, 0, 0, 0.35);
  transform: scale(1.1);
  color: #FFFFFF;
}
#stepRating.step-active .step-label {
  color: #E60000;
  font-weight: 800;
}

/* Step 2: Cerita (Pending Pastel Warm Peach) */
#stepCerita:not(.step-active):not(.step-done) .step-dot {
  background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
  border-color: #FED7AA;
  box-shadow: 0 2px 8px rgba(251, 146, 60, 0.15);
}
#stepCerita:not(.step-active):not(.step-done) .step-label {
  color: #EA580C;
}

/* Step 3: Kirim (Pending Pastel Fresh Mint) */
#stepKirim:not(.step-active):not(.step-done) .step-dot {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  border-color: #BBF7D0;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}
#stepKirim:not(.step-active):not(.step-done) .step-label {
  color: #16A34A;
}

/* Generic Active step */
.step-item.step-active .step-dot {
  background: var(--theme-accent, #E60000);
  border-color: var(--theme-accent, #E60000);
  box-shadow: 0 4px 14px rgba(230, 0, 0, 0.3);
  transform: scale(1.12);
}

.step-item.step-active .step-label {
  color: var(--theme-accent, #E60000);
  font-weight: 800;
}

/* Done step */
.step-item.step-done .step-dot {
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  border-color: #16A34A;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
  transform: scale(1.02);
}

.step-item.step-done .step-icon {
  display: none;
}

.step-item.step-done .step-check {
  display: block;
}

.step-item.step-done .step-label {
  color: #16A34A;
  font-weight: 700;
}

/* Connector line */
.step-connector {
  flex: 1;
  height: 3px;
  background: linear-gradient(90deg, #FED7AA 0%, #BBF7D0 100%);
  border-radius: 99px;
  margin: 0 6px;
  margin-bottom: 18px;
  transition: background 0.5s ease;
  max-width: 60px;
  opacity: 0.8;
}

.step-connector.filled {
  background: linear-gradient(90deg, #22C55E 0%, #06D6A0 100%);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
  opacity: 1;
}

/* Step active pulse animation */
@keyframes stepPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(230, 0, 0, 0.3); }
  50% { box-shadow: 0 4px 22px rgba(230, 0, 0, 0.5); }
}

.step-item.step-active .step-dot {
  animation: stepPulse 2s infinite;
}

/* ==========================================================================
   CARDS & FORM LAYOUT
   ========================================================================== */

.section-content {
  padding: 10px 12px 16px;
  flex: 1;
}

.section-content.hidden {
  display: none;
}

.form-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 6px rgba(10, 37, 64, 0.04);
  transition: transform var(--transition-fast), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--m88-navy);
  line-height: 1.25;
}

.card-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.center-header {
  display: flex;
  justify-content: center;
  text-align: center;
  margin-bottom: 6px;
}
.text-center {
  text-align: center;
}

/* ==========================================================================
   5 STARS RATING BAR (Warm & Inviting Golden Star Styling)
   ========================================================================== */

.stars-rating-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 8px 0 6px;
}

.star-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

/* Gentle breathing pulse before first rating click */
.stars-rating-bar:not(.has-rated) .star-btn {
  animation: starPulse 2.4s ease-in-out infinite alternate;
}
.stars-rating-bar:not(.has-rated) .star-btn:nth-child(1) { animation-delay: 0s; }
.stars-rating-bar:not(.has-rated) .star-btn:nth-child(2) { animation-delay: 0.18s; }
.stars-rating-bar:not(.has-rated) .star-btn:nth-child(3) { animation-delay: 0.36s; }
.stars-rating-bar:not(.has-rated) .star-btn:nth-child(4) { animation-delay: 0.54s; }
.stars-rating-bar:not(.has-rated) .star-btn:nth-child(5) { animation-delay: 0.72s; }

@keyframes starPulse {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-3px) scale(1.06); }
}

.star-btn:hover {
  transform: scale(1.18);
}

.star-btn:active {
  transform: scale(0.88);
}

.star-svg {
  width: 48px;
  height: 48px;
  fill: #FFFDF5;
  stroke: #F6C466;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 7px rgba(245, 158, 11, 0.22));
  transition: fill 0.25s ease, stroke 0.25s ease, filter 0.25s ease, transform 0.25s ease;
}

/* Filled / Active Star */
.star-btn.filled .star-svg {
  fill: #FFB703;
  stroke: #EA580C;
  stroke-width: 1.4;
  filter: drop-shadow(0 4px 10px rgba(251, 133, 0, 0.5));
}

/* Shimmer on hover when not filled */
.star-btn:not(.filled):hover .star-svg {
  fill: #FFE894;
  stroke: #FB8500;
  filter: drop-shadow(0 0 12px rgba(255, 183, 3, 0.85));
  transform: scale(1.15) rotate(4deg);
}

.star-btn.bounce .star-svg {
  animation: starPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes starPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45) rotate(-8deg); }
  70% { transform: scale(0.9) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.rating-feedback-label {
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  color: #B45309;
  background: #FFFBEB;
  border: 1.5px dashed #FDE68A;
  border-radius: var(--radius-full);
  padding: 5px 16px;
  margin: 8px auto 2px;
  display: inline-block;
  min-height: 22px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.08);
}

.rating-feedback-label.popin {
  animation: labelPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes labelPopIn {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.rating-feedback-label.active-1,
.rating-feedback-label.active-2 {
  color: #DC2626;
  background: #FEF2F2;
  border-color: #FECACA;
  border-style: solid;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}
.rating-feedback-label.active-3 {
  color: #D97706;
  background: #FFFBEB;
  border-color: #FDE68A;
  border-style: solid;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.rating-feedback-label.active-4,
.rating-feedback-label.active-5 {
  color: #15803D;
  background: #F0FDF4;
  border-color: #BBF7D0;
  border-style: solid;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

/* ==========================================================================
   DYNAMIC STORY CARD REVEAL
   ========================================================================== */

.dynamic-story-card.hidden {
  display: none;
}

.dynamic-story-card {
  animation: slideFadeIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
  overflow: hidden;
  border-left: 5px solid var(--fresh-emerald);
  padding: 13px 12px;
  transition: all 0.35s ease;
}

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

/* ==========================================================================
   DYNAMIC SENTIMENT CARD (OPSI 2)
   ========================================================================== */

.dynamic-story-card.sentiment-low {
  border-left-color: #FF4D4F;
  background: linear-gradient(180deg, #FFF7F6 0%, #FFFFFF 100%);
  border-color: #FFCCC7;
}

.dynamic-story-card.sentiment-mid {
  border-left-color: #FAAD14;
  background: linear-gradient(180deg, #FFFDF0 0%, #FFFFFF 100%);
  border-color: #FFE58F;
}

.dynamic-story-card.sentiment-high {
  border-left-color: #52C41A;
  background: linear-gradient(180deg, #F6FFED 0%, #FFFFFF 100%);
  border-color: #B7EB8F;
}

.dynamic-label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--m88-navy);
  line-height: 1.3;
  margin-bottom: 2px;
  transition: color 0.3s ease;
}

.label-helper {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 8px;
}

/* ==========================================================================
   QUICK CHIPS (with stagger reveal animation)
   ========================================================================== */

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(10, 37, 64, 0.04);
  opacity: 0;
  transform: translateY(6px);
  animation: chipSlideIn 0.35s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

@keyframes chipSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quick-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(10, 37, 64, 0.1);
}

/* 1. Low Sentiment Chips (1-2 Bintang - Perlu Perbaikan) */
.sentiment-low .quick-chip {
  background: #FFF5F5;
  border-color: #FECACA;
  color: #991B1B;
}
.sentiment-low .quick-chip:hover {
  background: #FEE2E2;
  border-color: #F87171;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.18);
}
.sentiment-low .quick-chip.selected {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: #FFFFFF;
  border-color: #B91C1C;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.38);
  transform: translateY(-2px) scale(1.02);
}

/* 2. Mid Sentiment Chips (3 Bintang - Cukup/Masukan) */
.sentiment-mid .quick-chip {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}
.sentiment-mid .quick-chip:hover {
  background: #FEF3C7;
  border-color: #F59E0B;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.18);
}
.sentiment-mid .quick-chip.selected {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
  border-color: #B45309;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.38);
  transform: translateY(-2px) scale(1.02);
}

/* 3. High Sentiment Chips (4-5 Bintang - Sangat Puas) */
.sentiment-high .quick-chip {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: #166534;
}
.sentiment-high .quick-chip:hover {
  background: #DCFCE7;
  border-color: #10B981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.18);
}
.sentiment-high .quick-chip.selected {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  border-color: #047857;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.38);
  transform: translateY(-2px) scale(1.02);
}

/* Fallback default chip selected */
.quick-chip.selected {
  background: var(--m88-navy);
  color: #FFFFFF;
  border-color: var(--m88-navy);
  box-shadow: 0 4px 10px rgba(10, 37, 64, 0.2);
}

/* ==========================================================================
   TEXTAREAS
   ========================================================================== */

.textarea-wrapper {
  position: relative;
}

.custom-textarea {
  width: 100%;
  padding: 10px 12px;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  resize: vertical;
  min-height: 76px;
  outline: none;
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.custom-textarea:focus {
  border-color: var(--m88-navy);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.1);
}

.textarea-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.char-counter {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 600;
}

.mt-3 {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

/* ==========================================================================
   SUBMIT BUTTON (Multi-state: idle / loading / success)
   ========================================================================== */

.submit-wrapper {
  margin-top: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.btn-submit {
  width: 100%;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--m88-red) 0%, #FF2A4D 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-colored);
  transition: all 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(230, 0, 0, 0.32);
}

.btn-submit:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-submit:disabled {
  background: #F8FAFC;
  color: #94A3B8;
  border: 1.5px dashed #CBD5E1;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  opacity: 0.9;
}

/* Ripple effect */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  width: 10px;
  height: 10px;
  pointer-events: none;
  transform: scale(0);
  opacity: 0;
}

.btn-ripple.animate {
  animation: rippleEffect 0.6s linear;
}

@keyframes rippleEffect {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(30); opacity: 0; }
}

.btn-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  font-size: 1.2rem;
  animation: rocketTilt 2s infinite ease-in-out;
}

@keyframes rocketTilt {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-3px) rotate(6deg); }
}

/* Loading state */
.btn-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.btn-success {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* State visibility helpers */
.btn-submit.state-loading .btn-inner { display: none; }
.btn-submit.state-loading .btn-loading { display: flex !important; }
.btn-submit.state-loading .btn-success { display: none !important; }

.btn-submit.state-success .btn-inner { display: none; }
.btn-submit.state-success .btn-loading { display: none !important; }
.btn-submit.state-success .btn-success { display: flex !important; }
.btn-submit.state-success {
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.35);
}

.hidden {
  display: none !important;
}

.submit-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.4;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  padding: 14px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  background: #FAFBFE;
}

.footer-brand {
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--m88-navy);
}

.footer-copy {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 3px;
}

/* ==========================================================================
   SUCCESS MODAL (Full-Screen Celebration)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding: 20px;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 28px;
  padding: 36px 28px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(10, 37, 64, 0.25);
  position: relative;
  overflow: hidden;
  transform: scale(0.88) translateY(20px);
  transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.modal-backdrop.show .modal-card {
  transform: scale(1) translateY(0);
}

/* Animated gradient glow bg inside modal */
.modal-glow-bg {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 183, 3, 0.25), rgba(6, 214, 160, 0.15), transparent 70%);
  pointer-events: none;
  animation: glowPulse 3s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  0% { transform: translateX(-50%) scale(1); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1.2); opacity: 1; }
}

/* Emoji ring with bounce */
.modal-emoji-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFF8D6, #FFFDF0);
  border: 3px solid rgba(255, 183, 3, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(255, 183, 3, 0.25);
  animation: emojiFloat 2.5s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

@keyframes emojiFloat {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

.modal-emoji-big {
  font-size: 2.6rem;
  line-height: 1;
  animation: emojiBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

@keyframes emojiBounce {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--m88-navy);
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.modal-message {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

/* Thank-you receipt card */
.thank-card {
  background: linear-gradient(135deg, #F8FAFF, #F0F7FF);
  border: 1.5px solid #E2E8F5;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
  text-align: left;
  position: relative;
  z-index: 1;
  animation: thankCardSlide 0.5s cubic-bezier(0.34, 1.2, 0.64, 1) 0.2s both;
}

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

.thank-card-stars {
  font-size: 1.3rem;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.thank-card-details {
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.6;
}

.thank-card-details div {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.modal-buttons {
  position: relative;
  z-index: 1;
}

.btn-modal-primary {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--m88-navy) 0%, var(--m88-navy-light) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 8px 20px rgba(10, 37, 64, 0.22);
}

.btn-modal-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(10, 37, 64, 0.3);
}

/* ==========================================================================
   CANVAS CONFETTI
   ========================================================================== */

#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}

/* ==========================================================================
   FIELD GROUP HELPERS
   ========================================================================== */

.field-group {
  margin-bottom: 0;
}

/* ==========================================================================
   OPTIONAL BADGE (muncul saat chip dipilih)
   ========================================================================== */

.optional-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #16A34A;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-full);
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
