/* =============================================
   Reverse FAP v2.0 — style.css
   Tema: Retro-Futurista / CRT oscuro
   ============================================= */

:root {
  --bg:        #0a0a0f;
  --bg2:       #12121a;
  --bg3:       #1a1a28;
  --border:    #2a2a44;
  --accent:    #00e5ff;
  --accent2:   #ff2d78;
  --accent3:   #a0ff60;
  --text:      #c8d0e0;
  --text-dim:  #5a6080;
  --error:     #ff4466;
  --selected:  #00e5ff33;
  --canvas-bg: #0d0d18;
  --font-mono: 'Share Tech Mono', monospace;
  --font-head: 'Orbitron', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: hidden;
}

/* Scanlines sutil */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.04) 2px,
    rgba(0,0,0,0.04) 4px
  );
  z-index: 9999;
}

/* ---- HEADER ---- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  height: 42px;
  flex-shrink: 0;
}

.logo { display: flex; align-items: baseline; gap: 6px; }

.logo-reverse {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 3px;
  text-shadow: 0 0 12px var(--accent);
}
.logo-fap {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 2px;
}
.logo-version {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

#fps-label { color: var(--text-dim); font-size: 11px; }

#fps-input {
  width: 48px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--accent3);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  padding: 2px 4px;
  border-radius: 3px;
}
#fps-input:focus { outline: none; border-color: var(--accent); }

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.mode-toggle input { display: none; }
.mode-label {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent3);
  letter-spacing: 1px;
  padding: 3px 8px;
  border: 1px solid var(--accent3);
  border-radius: 3px;
  transition: all .2s;
}
.mode-toggle input:checked + .mode-label {
  color: var(--accent2);
  border-color: var(--accent2);
  background: #ff2d7811;
}

/* ---- MAIN LAYOUT ---- */
main {
  display: flex;
  height: calc(100vh - 42px - 130px - 40px);
  min-height: 200px;
  overflow: hidden;
}

/* ---- EDITOR PANEL ---- */
#editor-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--border);
}

#editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  height: 28px;
}
.toolbar-label {
  font-family: var(--font-head);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
}
#frame-indicator { font-size: 11px; color: var(--accent); }

/* CodeMirror */
.CodeMirror {
  flex: 1;
  height: 100%;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  line-height: 1.5;
  background: var(--bg) !important;
  border: none !important;
}
.CodeMirror-scroll { height: 100%; }

#error-console {
  padding: 4px 10px;
  min-height: 20px;
  max-height: 60px;
  overflow-y: auto;
  font-size: 11px;
  color: var(--error);
  background: #1a080a;
  border-top: 1px solid #3a1020;
  white-space: pre-wrap;
  font-family: var(--font-mono);
}

/* ---- CANVAS PANEL ---- */
#canvas-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px;
  gap: 10px;
  background: var(--bg2);
  width: 310px;
  flex-shrink: 0;
}

#canvas-wrapper {
  position: relative;
}

#animation-canvas {
  display: block;
  background: var(--canvas-bg);
  border: 1px solid var(--border);
  box-shadow: 0 0 20px rgba(0,229,255,0.08), 0 0 2px rgba(0,229,255,0.3);
  image-rendering: pixelated;
}

#canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: rgba(0,229,255,0.5);
  pointer-events: none;
  transition: opacity .3s;
}
#canvas-overlay.hidden { display: none; }

/* Transport */
#transport {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  width: 100%;
}

/* ---- BOTONES ---- */
.btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--selected); }
.btn.active { border-color: var(--accent); color: var(--accent); background: var(--selected); }

.btn-play     { border-color: var(--accent3); color: var(--accent3); }
.btn-play:hover { background: #a0ff6022; }
.btn-play.active { background: #a0ff6022; }

.btn-play-all { border-color: var(--accent); color: var(--accent); }
.btn-play-all:hover { background: var(--selected); }

.btn-pause { border-color: var(--accent2); color: var(--accent2); }
.btn-pause:hover { background: #ff2d7822; }

.btn-loop { border-color: #aa88ff; color: #aa88ff; }
.btn-loop:hover, .btn-loop.active { background: #aa88ff22; }

.btn-add { border-color: var(--accent3); color: var(--accent3); }
.btn-del { border-color: var(--accent2); color: var(--accent2); }
.btn-save { border-color: #ffcc44; color: #ffcc44; }
.btn-load { border-color: #44aaff; color: #44aaff; }

/* ---- FOOTER / TIMELINE ---- */
footer {
  height: 130px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  overflow: hidden;
  flex-shrink: 0;
}

#timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
  height: 32px;
  flex-shrink: 0;
}
#timeline-actions { display: flex; gap: 5px; flex-wrap: nowrap; }

#film-reel {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#film-reel::-webkit-scrollbar { height: 4px; }
#film-reel::-webkit-scrollbar-track { background: transparent; }
#film-reel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.frame-thumb {
  flex-shrink: 0;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: all .15s;
  background: var(--bg3);
}
.frame-thumb:hover { border-color: var(--accent); }
.frame-thumb.selected {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0,229,255,0.3);
}
.frame-thumb canvas {
  display: block;
  width: 64px;
  height: 56px;
  image-rendering: pixelated;
}
.frame-label {
  font-size: 9px;
  color: var(--text-dim);
  padding: 1px 0 2px;
  font-family: var(--font-head);
  letter-spacing: 1px;
}
.frame-thumb.selected .frame-label { color: var(--accent); }

/* ---- REF BAR ---- */
#ref-bar {
  height: 40px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

#ref-toggle {
  height: 40px;
  padding: 0 14px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  transition: color .2s;
}
#ref-toggle:hover { color: var(--accent); }

#ref-panel {
  position: fixed;
  bottom: 40px;
  left: 0; right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}
#ref-panel.hidden { display: none; }

.ref-cols {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.ref-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}
.ref-col h4 {
  font-family: var(--font-head);
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.ref-col code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent3);
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 2px;
  border-left: 2px solid var(--accent3);
}

/* ---- SCROLLBAR GLOBAL ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- RESPONSIVE mínimo ---- */
@media (max-width: 700px) {
  main { flex-direction: column; }
  #canvas-panel { width: 100%; padding: 6px; }
  #animation-canvas { width: 100%; height: auto; }
}
