/* ==========================================================================
   GlitchLab • Estúdio de Shaders CRT, VHS & Aberração Cromática
   Design System: Artes do Sul Cyber-Dark & CRT Retrofuturism
   ========================================================================== */

:root {
  --bg-primary: #040508;
  --bg-secondary: #0a0d14;
  --bg-card: rgba(16, 20, 30, 0.75);
  --bg-glass: rgba(10, 13, 20, 0.9);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 0, 128, 0.4);
  --border-glow: rgba(0, 240, 255, 0.2);

  --accent-cyan: #00f0ff;
  --accent-magenta: #ff007f;
  --accent-neon: #39ff14;
  --accent-amber: #ffb700;

  --text-main: #f0f4f8;
  --text-muted: #8a99ad;
  --text-dim: #4e5d73;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-width: 380px;
  --header-height: 56px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }

/* App Container */
#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: var(--bg-primary);
}

/* Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 50;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo-gem {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-magenta), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(255, 0, 127, 0.4);
}

.glitch-icon {
  font-size: 14px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-glitch {
  color: var(--accent-magenta);
  text-shadow: 0 0 8px rgba(255, 0, 127, 0.6);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* Header Presets */
.header-presets {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
}

.preset-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-right: 0.25rem;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-preset.active {
  background: rgba(255, 0, 127, 0.15);
  border-color: var(--accent-magenta);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
}

/* Header Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-action-outline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
}

.btn-action-record {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 0, 55, 0.15);
  border: 1px solid rgba(255, 0, 55, 0.4);
  color: #ff4d6d;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-record:hover {
  background: rgba(255, 0, 55, 0.3);
  box-shadow: 0 0 12px rgba(255, 0, 55, 0.4);
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff0037;
  box-shadow: 0 0 6px #ff0037;
  animation: recBlink 1.5s infinite;
}

@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Workspace */
.app-workspace {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height));
  position: relative;
  overflow: hidden;
}

/* Canvas Viewport */
.canvas-viewport {
  flex: 1;
  position: relative;
  background: #020204;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#glitch-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

/* Drop Zone */
.drop-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  z-index: 20;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.drop-zone.hidden {
  opacity: 0;
  pointer-events: none;
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  border: 2px dashed rgba(0, 240, 255, 0.4);
  padding: 2.5rem 3rem;
  border-radius: 12px;
  background: rgba(10, 15, 24, 0.6);
  text-align: center;
  transition: all 0.2s ease;
}

.drop-card:hover {
  border-color: var(--accent-cyan);
  background: rgba(10, 15, 24, 0.85);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.2);
}

.drop-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.drop-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.file-hidden {
  display: none;
}

/* HUD */
.viewport-hud {
  position: absolute;
  bottom: 1.25rem;
  left: 1.25rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 15;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hud-label { color: var(--text-dim); }

/* Sidebar */
.control-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.sidebar-badge {
  font-size: 10px;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 0, 127, 0.1);
  border: 1px solid var(--border-active);
  color: var(--accent-magenta);
  border-radius: 4px;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-group {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.group-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.slider-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.slider-value {
  font-size: 11px;
  color: var(--accent-cyan);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-magenta);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-magenta);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.tone-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.btn-tone {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  padding: 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tone.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.btn-export {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-export:hover {
  background: rgba(255, 255, 255, 0.12);
}

.primary-export {
  background: linear-gradient(135deg, rgba(255, 0, 127, 0.2), rgba(0, 240, 255, 0.2));
  border-color: var(--accent-magenta);
  color: #fff;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(12, 16, 24, 0.95);
  border: 1px solid var(--accent-magenta);
  box-shadow: 0 0 20px rgba(255, 0, 127, 0.3);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 999;
}

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