/* ==========================================================================
   TWIBBON MUDA BERGEMA 2026 - THE ARETE GENERATION
   Mobile-First, Modern, Clean & High Performance Styling
   ========================================================================== */

:root {
  --primary: #1E40AF;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-gradient: linear-gradient(135deg, #1E40AF 0%, #2563EB 50%, #1D4ED8 100%);
  
  --secondary: #FACC15;
  --secondary-hover: #EAB308;
  --secondary-gradient: linear-gradient(135deg, #FACC15 0%, #F59E0B 100%);
  
  --accent: #3B82F6;
  --success: #10B981;
  --success-hover: #059669;
  --success-gradient: linear-gradient(135deg, #10B981 0%, #059669 100%);
  
  --bg-page: #F1F5F9;
  --bg-card: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-light: #E2E8F0;
  --border-focus: #3B82F6;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(30, 64, 175, 0.12), 0 10px 10px -5px rgba(30, 64, 175, 0.06);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  margin: 0;
  background-image: radial-gradient(#CBD5E1 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Mobile-First Shell Container */
.app-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--bg-card);
  margin: 0 auto;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  padding: 1.25rem 1.25rem 0.75rem 1.25rem;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.95);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.4rem;
  border: 1px solid rgba(30, 64, 175, 0.15);
}

.brand-badge i {
  color: var(--secondary-hover);
}

.campaign-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.campaign-title span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.campaign-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-weight: 500;
}

/* Step Bar Indicator */
.flow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-page);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.step-item.active {
  color: var(--primary);
}

.step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #CBD5E1;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

.step-item.active .step-num {
  background: var(--primary);
}

.step-sep {
  color: #94A3B8;
  font-size: 0.65rem;
}

/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */
.main-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

/* ==========================================================================
   TWIBBON PREVIEW AREA (1:1 BOX)
   ========================================================================== */
.twibbon-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  padding: 0.75rem;
  position: relative;
}

.frame-type-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.frame-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.frame-tab-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

.twibbon-viewport {
  width: 100%;
  aspect-ratio: 819 / 1024;
  background-color: #E2E8F0;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
}

.twibbon-viewport:active {
  cursor: grabbing;
}

#twibbonCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Empty State / Photo Upload Trigger Overlay */
.empty-state-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.empty-state-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.silhouette-box {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  animation: pulse-avatar 2s infinite ease-in-out;
}

@keyframes pulse-avatar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.btn-upload-prominent {
  background: var(--secondary-gradient);
  color: #78350F;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-full);
  border: none;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-upload-prominent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.55);
}

.upload-hint-text {
  color: #F8FAFC;
  font-size: 0.72rem;
  margin-top: 0.75rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  font-weight: 500;
}

/* ==========================================================================
   MINIMALIST PHOTO EDITOR CONTROLS
   ========================================================================== */
.editor-controls {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.editor-controls.hidden {
  display: none;
}

/* Zoom Control Bar */
.zoom-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-page);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.zoom-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.zoom-btn {
  width: 28px;
  height: 28px;
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.zoom-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.zoom-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 4px;
  background: #CBD5E1;
  outline: none;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--secondary);
  border: 2px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s;
}

.zoom-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

/* Secondary Actions (Ganti Foto, Putar, Reset) */
.editor-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
}

.btn-ctrl {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.4rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ctrl:hover {
  background: var(--bg-page);
  border-color: #94A3B8;
}

.btn-ctrl.btn-replace {
  color: var(--primary);
  border-color: rgba(30, 64, 175, 0.3);
  background: var(--primary-light);
}

.btn-ctrl.btn-replace:hover {
  background: #DBEAFE;
}

.drag-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* ==========================================================================
   DOWNLOAD BUTTON
   ========================================================================== */
.download-section {
  width: 100%;
}

.btn-download-main {
  width: 100%;
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.95rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  box-shadow: 0 6px 18px rgba(30, 64, 175, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-download-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(30, 64, 175, 0.45);
}

.btn-download-main:active {
  transform: translateY(1px);
}

.btn-download-main.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-download-main .download-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

/* ==========================================================================
   CAPTION SIAP SALIN (FOKUS UTAMA)
   ========================================================================== */
.caption-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.caption-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.caption-title-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.caption-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.caption-indicator {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* Quick Name Customizer Field */
.name-customizer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-page);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.name-customizer label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.name-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-main);
  font-weight: 500;
}

.name-input::placeholder {
  color: #94A3B8;
}

/* Caption Textarea */
.caption-textarea {
  width: 100%;
  min-height: 140px;
  max-height: 240px;
  background: #F8FAFC;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-main);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.caption-textarea:focus {
  border-color: var(--border-focus);
  background-color: #FFFFFF;
}

/* Copy Action Row */
.caption-action-row {
  display: flex;
  gap: 0.5rem;
}

.btn-copy-main {
  flex: 2;
  background: var(--success-gradient);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-copy-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.btn-copy-main:active {
  transform: translateY(1px);
}

.btn-copy-main.copied {
  background: #059669;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}

.btn-change-caption {
  flex: 1;
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.6rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.btn-change-caption:hover {
  background: var(--bg-page);
  border-color: #94A3B8;
}

/* ==========================================================================
   ALUR SETELAH DOWNLOAD ("LANGKAH TERAKHIR")
   ========================================================================== */
.final-step-card {
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFFFF 100%);
  border-radius: var(--radius-lg);
  border: 1.5px solid #BFDBFE;
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.3s ease;
}

.final-step-card.hidden {
  display: none;
}

.final-step-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.final-step-header i {
  color: #2563EB;
  font-size: 1.2rem;
}

.final-step-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.final-instructions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.instruction-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-main);
  font-weight: 500;
}

.instruction-badge {
  width: 20px;
  height: 20px;
  background: #2563EB;
  color: #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.quick-share-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.btn-share {
  padding: 0.65rem 0.4rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-share:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

.btn-share.share-ig {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: #FFFFFF;
}

.btn-share.share-wa {
  background: #25D366;
  color: #FFFFFF;
}

.btn-share.share-all {
  background: var(--primary);
  color: #FFFFFF;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  padding: 1.5rem 1.25rem 2rem 1.25rem;
  background: #FFFFFF;
  border-top: 1px solid var(--border-light);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-organizer {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.footer-tagline {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  font-style: italic;
}

.footer-socials {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
}

.social-pill {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.social-pill:hover {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.footer-copy {
  font-size: 0.7rem;
  color: #94A3B8;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: #0F172A;
  color: #FFFFFF;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  margin-top: 0.5rem;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success i {
  color: #34D399;
}

.toast.toast-error i {
  color: #F87171;
}

.toast.toast-info i {
  color: #60A5FA;
}

/* ==========================================================================
   IN-APP BROWSER / LONG-PRESS MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-content {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-preview-img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.modal-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-close-modal {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}
