/* Truva Design Automation Studio Styles */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&family=Cinzel:wght@600;700;900&family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Syne:wght@600;700;800&display=swap');

:root {
  --primary-orange: #FF5A1F;
  --primary-orange-light: #FF7E47;
  --primary-orange-glow: rgba(255, 90, 31, 0.45);
  --bg-dark: #0B0E14;
  --bg-card: #131720;
  --bg-panel: #181D28;
  --border-color: #242B38;
  --border-active: #FF5A1F;
  --text-main: #FFFFFF;
  --text-muted: #94A3B8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: #2A303C #12151B;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Layer Stacking for Canvas */
.layer-bg-photo {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.layer-orange-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56%;
  z-index: 2;
  pointer-events: none;
  /* Pre-rendered pixel-for-pixel copy of the original CSS gradient
     (180deg, #E63E00 0% -> #FF4500 15% -> #FF5418 35% -> #FF6322 50% ->
     rgba(245,78,20,.95) 65% -> rgba(245,78,20,.55) 82% -> rgba(245,78,20,0) 100%).
     html2canvas doesn't reliably interpolate this gradient's semi-transparent
     tail and was rendering a hard cutoff instead of a smooth fade in exports;
     a plain image composites correctly in every case and looks identical. */
  background-image: url('assets/orange-gradient.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  transition: all 0.25s ease;
}

.layer-light-rays {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52%;
  z-index: 3;
  pointer-events: none;
  background: url('assets/truva-glow-rays.jpg') no-repeat top center;
  background-size: cover;
  mix-blend-mode: screen;
  opacity: 0.95;
  transition: all 0.25s ease;
}

.layer-radial-spotlight {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 220, 180, 0.45) 0%, rgba(255, 90, 31, 0.2) 50%, rgba(255, 90, 31, 0) 85%);
  mix-blend-mode: overlay;
  transition: all 0.25s ease;
}

.layer-bottom-shade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38%;
  z-index: 5;
  pointer-events: none;
  /* No-JS fallback only. app.js (see GRADIENT BAKING) replaces this at
     runtime with a pre-baked image at the layer's exact pixel height, because
     html2canvas renders this gradient's transparent edge as a hard line in
     exports. Keep the stops here in sync with updateLivePreview(). */
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0) 100%);
  transition: all 0.25s ease;
}

.layer-artboard-content {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
}

/* Range Input Custom Styling */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: #262B36;
  height: 5px;
  border-radius: 4px;
  outline: none;
  transition: all 0.2s ease;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #FF5A1F;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 90, 31, 0.6);
  border: 2px solid #FFFFFF;
  transition: transform 0.15s ease;
}
input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: #FF7E47;
}

/* Custom Glow Effects */
.glow-orange {
  box-shadow: 0 0 25px rgba(255, 90, 31, 0.25);
}

.glow-orange-sm {
  box-shadow: 0 0 12px rgba(255, 90, 31, 0.35);
}

.glow-text {
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.35), 0 0 40px rgba(255, 90, 31, 0.4);
}

/* Glassmorphism */
.glass-panel {
  background: rgba(24, 29, 40, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-card {
  background: rgba(19, 23, 32, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Creative Canvas Container */
#creative-artboard {
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 90, 31, 0.2);
  transform-origin: center center;
  user-select: none;
  background-color: #0B0E14;
  transition: width 0.3s ease, height 0.3s ease;
}

/* Aspect Ratio Dimensions (Preview Scale) */
.aspect-1-1 {
  width: 560px;
  height: 560px;
}
.aspect-9-16 {
  width: 380px;
  height: 675px;
}
.aspect-16-9 {
  width: 640px;
  height: 360px;
}
.aspect-4-5 {
  width: 480px;
  height: 600px;
}

/* Toast Notification */
#toast-notification {
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Text order: draggable blocks on the artboard + the sidebar order list
   ========================================================================== */
.reorder-item {
  cursor: grab;
  touch-action: none;
  border-radius: 6px;
  outline: 1.5px dashed transparent;
  outline-offset: 5px;
  transition: outline-color .15s ease;
}
#creative-artboard:not(.is-reordering) .reorder-item:hover { outline-color: rgba(255, 255, 255, 0.5); }
#creative-artboard.is-reordering .reorder-item { cursor: grabbing; }
.reorder-item.is-dragging { opacity: 0.55; outline-color: rgba(255, 255, 255, 0.9); }

.order-list .order-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  background: var(--bg-card, #0F1420);
  border: 1px solid var(--border-color, #242B38);
  border-radius: 8px;
  font-size: 11px; color: #cbd5e1;
  cursor: grab; user-select: none;
}
.order-list .order-row.dragging { opacity: 0.5; border-style: dashed; }
.order-list .order-row.is-hidden .order-label { opacity: 0.5; }
.order-list .order-row .order-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-list .order-row .order-label em { font-style: normal; font-size: 10px; color: #64748b; }
.order-list .order-grip { color: #64748b; letter-spacing: -2px; font-size: 12px; }
.order-list .order-btn {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--border-color, #242B38);
  background: transparent; color: #94a3b8; font-size: 9px; line-height: 1;
  cursor: pointer; transition: color .12s, border-color .12s, background .12s;
}
.order-list .order-btn:hover:not(:disabled) { color: #fff; border-color: #FF5A1F; background: rgba(255, 90, 31, 0.12); }
.order-list .order-btn:disabled { opacity: 0.3; cursor: default; }

/* Footer lines are editable on the preview */
#creative-artboard [contenteditable="true"] { cursor: text; border-radius: 4px; }
#creative-artboard [contenteditable="true"]:focus { outline: 1px dashed rgba(255,255,255,0.8); outline-offset: 4px; }
