/**
 * RAM SENA - Sprite & Image Studio Styles (css/editor.css)
 * Premium Dark Mode & Saffron Gold Devotional Theme
 */

:root {
  --bg-deep: #030712;
  --bg-card: #0b1329;
  --bg-panel: rgba(15, 23, 42, 0.85);
  --border-gold: rgba(245, 158, 11, 0.35);
  --border-gold-bright: #f59e0b;
  --saffron: #f97316;
  --saffron-light: #fdba74;
  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.25);
  --teal-emerald: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-retro: 'Press Start 2P', monospace;
  --font-ui: 'Cinzel', serif, system-ui;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* TOP NAVBAR */
#editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: rgba(11, 19, 41, 0.95);
  border-bottom: 2px solid var(--border-gold);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6));
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 50%, #ea580c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-editor-nav {
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.btn-back-game {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}

.btn-back-game:hover {
  background: #334155;
  color: #ffffff;
  border-color: #94a3b8;
}

.btn-export-top {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: 1px solid #fef08a;
  color: #040711;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.btn-export-top:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
}

/* MAIN LAYOUT (3-COLUMN DESKTOP) */
#studio-layout {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  flex: 1;
  height: calc(100vh - 65px);
  overflow: hidden;
}

/* LEFT PANEL: SPRITE SOURCE GALLERY */
#left-panel {
  background: rgba(11, 19, 41, 0.85);
  border-right: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.2rem;
  gap: 1.2rem;
}

.panel-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--saffron-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  padding-bottom: 0.5rem;
}

/* UPLOAD DROPZONE */
.dropzone-box {
  border: 2px dashed rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  padding: 1.2rem 0.8rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.1);
}

.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}

.dropzone-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
}

.dropzone-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

#file-input {
  display: none;
}

/* CHARACTER SELECT GRID */
.sprite-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.sprite-thumb-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sprite-thumb-card:hover {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.12);
  transform: translateY(-2px);
}

.sprite-thumb-card.active {
  border: 2px solid var(--gold);
  background: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 12px var(--gold-glow);
}

.thumb-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.thumb-name {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #f1f5f9;
}

/* CENTER PANEL: INTERACTIVE CANVAS WORKSPACE */
#center-workspace {
  display: flex;
  flex-direction: column;
  background: #020617;
  position: relative;
  overflow: hidden;
}

.workspace-toolbar {
  padding: 0.6rem 1.2rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  z-index: 10;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.bg-select-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bg-select-btn:hover {
  background: #334155;
  color: #ffffff;
}

.bg-select-btn.active {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.25);
  color: var(--gold);
  font-weight: 700;
}

/* CANVAS VIEWPORT */
#canvas-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
  padding: 2rem;
}

/* CHECKERBOARD PATTERN */
.bg-checkerboard {
  background-color: #0f172a;
  background-image: 
    linear-gradient(45deg, #1e293b 25%, transparent 25%), 
    linear-gradient(-45deg, #1e293b 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #1e293b 75%), 
    linear-gradient(-45deg, transparent 75%, #1e293b 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.bg-meadow {
  background: #14532d;
}

.bg-beach {
  background: #b45309;
}

.bg-temple {
  background: #030712;
}

#editor-canvas {
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  max-width: 90%;
  max-height: 90%;
  image-rendering: auto;
}

/* LIVE MULTI-CONTEXT PREVIEW BAR AT BOTTOM */
#preview-bar {
  background: rgba(11, 19, 41, 0.95);
  border-top: 1px solid var(--border-gold);
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  overflow-x: auto;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.preview-label-box {
  display: flex;
  flex-direction: column;
}

.preview-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--gold);
}

.preview-desc {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Overworld Tile Mockup */
.preview-tile-box {
  width: 54px;
  height: 54px;
  background: #264e22;
  border-radius: 6px;
  border: 1px solid #4ade80;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-tile-shadow {
  position: absolute;
  bottom: 6px;
  width: 32px;
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
}

.preview-tile-sprite {
  width: 44px;
  height: 44px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  animation: spriteBob 1.8s ease-in-out infinite alternate;
}

@keyframes spriteBob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

/* Dialogue Box Mockup */
.preview-dialogue-mockup {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #042f2e;
  border: 1.5px solid #14b8a6;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
}

.dialogue-mockup-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #5eead4;
  object-fit: cover;
  background: #0f172a;
}

.dialogue-mockup-text {
  font-family: var(--font-retro);
  font-size: 0.55rem;
  color: #f0fdf4;
}

/* Hero Select Card Mockup */
.preview-card-mockup {
  width: 44px;
  height: 54px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
}

.card-mockup-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* RIGHT PANEL: EDITING CONTROLS */
#right-controls {
  background: rgba(11, 19, 41, 0.85);
  border-left: 1px solid var(--border-gold);
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.control-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--saffron-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ACTION BUTTONS */
.btn-action-primary {
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  border: 1px solid #fef08a;
  color: #040711;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-action-primary:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
}

.btn-action-secondary {
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
  transition: all 0.2s ease;
}

.btn-action-secondary:hover {
  background: #334155;
  color: #ffffff;
}

/* PRESET BUTTONS */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.btn-preset {
  padding: 0.45rem 0.4rem;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset:hover {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.15);
  color: #ffffff;
}

.btn-preset.active {
  border-color: var(--gold);
  background: rgba(245, 158, 11, 0.25);
  color: var(--gold);
}

/* SLIDERS & INPUTS */
.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.input-label {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 600;
}

.input-val-tag {
  font-family: var(--font-retro);
  font-size: 0.65rem;
  color: var(--gold);
}

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

.num-input {
  width: 75px;
  padding: 0.3rem 0.5rem;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 4px;
  color: #ffffff;
  font-family: var(--font-retro);
  font-size: 0.7rem;
  text-align: center;
}

.num-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* STATS BADGE */
.info-badge-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #0f172a;
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 0.72rem;
}

.info-badge-row {
  display: flex;
  justify-content: space-between;
}

.info-badge-row strong {
  color: #94a3b8;
}

.info-badge-row span {
  color: var(--gold);
  font-family: var(--font-retro);
  font-size: 0.62rem;
}

/* TOAST NOTIFICATION */
#editor-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #042f2e 0%, #0f172a 100%);
  border: 2px solid #10b981;
  border-radius: 8px;
  padding: 0.8rem 1.6rem;
  color: #ecfdf5;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  pointer-events: none;
}

#editor-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  #studio-layout {
    grid-template-columns: 240px 1fr 300px;
  }
}
