/* ============================================================
   TWIBBON MAKER — STYLESHEET
   Edit variabel di bagian :root untuk mengubah tema warna.
   Variabel ini di-override oleh config.js saat runtime.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables (default, akan di-override oleh config.js) ── */
:root {
  --color-primary:     #32A3A1;
  --color-secondary:   #03666B;
  --color-accent:      #98FFEE;
  --color-bg:          #001250;
  --color-surface:     rgba(3, 102, 107, 0.25);
  --color-surface-2:   rgba(50, 163, 161, 0.25);
  --color-text:        #FFFFFF;
  --color-text-muted:  #98FFEE;
  --color-border:      rgba(50, 163, 161, 0.35);
  --color-success:     #32A3A1;
  --color-error:       #EF4444;
  --color-warning:     #98FFEE;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,.35);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.45);
  --shadow-glow: 0 0 30px rgba(50,163,161,.35);

  --transition: .2s ease;
  --font: 'Inter', system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--color-bg);
  background-image: url('./assets/bg_dicefest.webp');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Background overlay gelap tipis agar teks tetap terbaca ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 18, 80, 0.65);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* ── Header ── */
.site-header {
  text-align: center;
  padding: 36px 20px 24px;
}

/* Gambar judul (analisa.png) */
.header-title-img {
  width: min(560px, 90%);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 6px 24px rgba(0,0,0,.5));
  animation: floatTitle 4s ease-in-out infinite;
}

@keyframes floatTitle {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(50, 163, 161, 0.2);
  border: 1px solid rgba(152, 255, 238, 0.4);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #98FFEE;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.header-badge svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Judul teks fallback (disembunyikan, diganti oleh gambar) */
.site-title { display: none; }

.site-subtitle {
  font-size: clamp(13px, 2vw, 16px);
  color: var(--color-text-muted);
  max-width: 480px;
  margin: 6px auto 0;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* ── Main Grid ── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 820px) {
  .main-grid { grid-template-columns: 1fr; }
}

/* ── Canvas Section ── */
.canvas-section {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;   /* Sesuai frame.png: 3240 × 4050 px (portrait) */
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0a0a14;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 40px rgba(0,0,0,.5), var(--shadow-glow);
  transition: box-shadow var(--transition);
}

.canvas-container:active { cursor: grabbing; }

.canvas-container.drag-active {
  box-shadow: inset 0 0 40px rgba(0,0,0,.5), 0 0 40px rgba(37,99,235,.5);
}

#mainCanvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Placeholder overlay saat belum ada foto */
.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  transition: opacity var(--transition);
}

.canvas-placeholder.hidden { opacity: 0; }

.placeholder-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(50, 163, 161, 0.15);
  border: 2px dashed rgba(50, 163, 161, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-icon svg { width: 28px; height: 28px; color: #98FFEE; }

.placeholder-text {
  font-size: 14px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 0 20px;
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: var(--radius-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  z-index: 10;
}

.loading-overlay.visible { opacity: 1; pointer-events: all; }

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* ── Controls Panel ── */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Card */
.card {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { width: 14px; height: 14px; }

/* Upload Drop Zone */
.drop-zone {
  position: relative;
  border: 2px dashed rgba(255,255,255,0.3);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: rgba(255,255,255,0.04);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--color-accent);
  background: rgba(50, 163, 161, 0.15);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(50, 163, 161, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.drop-icon svg { width: 22px; height: 22px; color: #98FFEE; }

.drop-label {
  font-size: 13px;
  color: var(--color-text);
  font-weight: 500;
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Error message */
.error-msg {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: #FCA5A5;
  margin-top: 10px;
}

.error-msg.visible { display: flex; }
.error-msg svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Warning message */
.warn-msg {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: #FCD34D;
  margin-top: 10px;
}

.warn-msg.visible { display: flex; }
.warn-msg svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Zoom Slider */
.zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zoom-icon { color: var(--color-text-muted); flex-shrink: 0; }
.zoom-icon svg { width: 16px; height: 16px; display: block; }

.zoom-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: var(--color-border);
  outline: none;
  cursor: pointer;
  transition: background var(--transition);
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-primary);
  cursor: grab;
  transition: transform var(--transition);
}

.zoom-slider::-webkit-slider-thumb:active { transform: scale(1.2); cursor: grabbing; }
.zoom-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-primary); border: 3px solid var(--color-surface);
  cursor: grab;
}

.zoom-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  min-width: 42px;
  text-align: right;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}

.btn:hover::after { background: rgba(255,255,255,.07); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, #32A3A1, #03666B);
  color: #FFFFFF;
  box-shadow: 0 4px 15px rgba(50,163,161,.45);
}

.btn-primary:hover { box-shadow: 0 6px 20px rgba(152,255,238,.4); }

.btn-success {
  background: linear-gradient(135deg, #32A3A1, #03666B);
  color: #FFFFFF;
  box-shadow: 0 4px 15px rgba(50,163,161,.45);
}

.btn-success:hover { box-shadow: 0 6px 20px rgba(152,255,238,.4); }

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover { color: var(--color-text); border-color: var(--color-text-muted); }

.btn-share {
  background: linear-gradient(135deg, #03666B, #001250);
  color: #98FFEE;
  border: 1px solid rgba(50,163,161,.5);
  box-shadow: 0 4px 15px rgba(3,102,107,.4);
}

.btn-full { width: 100%; }

.btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-group .btn-primary { grid-column: 1 / -1; }

/* Instructions */
.instructions {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.instructions-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions-title svg { width: 16px; height: 16px; color: var(--color-accent); }

.instructions ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.instructions li {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.instructions li strong { color: var(--color-text); }

/* Footer */
.site-footer {
  text-align: center;
  padding: 32px 20px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.site-footer a {
  color: #FFD27F;
  text-decoration: none;
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card, .canvas-section, .instructions {
  animation: fadeIn .4s ease both;
}

/* ── Responsive Mobile ── */
@media (max-width: 480px) {
  .site-header { padding: 28px 16px 20px; }
  .canvas-section, .card { padding: 16px; }
  .btn-group { grid-template-columns: 1fr; }
  .btn-group .btn-primary { grid-column: auto; }
}
