/* ══════════════════════════════════════════════════
   SnapBeat Retro Pop Design System — Styles
   ══════════════════════════════════════════════════ */

:root {
  --yellow: #FFE14D;
  --pink: #FF4D8D;
  --blue: #3DD4FF;
  --dark-blue: #0288D1;
  --deep-pink: #D81B60;
  --black: #000000;
  --white: #FFFFFF;
  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'Work Sans', -apple-system, sans-serif;
}

/* 🌙 Dark Theme (Default) */
[data-theme="dark"] {
  --bg-main: #1A1A1A;
  --bg-card: #222222;
  --border-card: #333333;
  --text-main: #FFFCF5;
  --text-dim: #999999;
  --text-dimmer: #666666;
  --divider: #333333;
  --input-bg: #2A2A2A;
  --input-border: #FFE14D;
  --input-text: #FFFCF5;
  --shadow-color: rgba(0, 0, 0, 0.7);
  --trim-box-bg: #2E2E2E;
  --modal-bg: #222222;
  --polaroid-bg: #2A2A2A;
  --polaroid-border: #444444;
}

/* ☀️ Light Theme */
[data-theme="light"] {
  --bg-main: #F4F4F6;
  --bg-card: #FFFFFF;
  --border-card: #E0E0E0;
  --text-main: #1A1A1A;
  --text-dim: #555555;
  --text-dimmer: #888888;
  --divider: #E5E5E5;
  --input-bg: #FFFFFF;
  --input-border: #CCCCCC;
  --input-text: #1A1A1A;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --trim-box-bg: #F0F0F2;
  --modal-bg: #FFFFFF;
  --polaroid-bg: #FFFFFF;
  --polaroid-border: #E0E0E0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.app-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ═══════════════ HEADER ═══════════════ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--yellow);
  text-shadow: 3px 3px 0px var(--black);
}

[data-theme="light"] .logo-title {
  color: #1A1A1A;
  text-shadow: 2px 2px 0px var(--yellow);
}

.logo-subtitle {
  font-size: 0.88rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 4px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.switch-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.switch-label.active {
  color: var(--yellow);
}

[data-theme="light"] .switch-label.active {
  color: #1A1A1A;
}

.switch-label.dimmed {
  color: var(--text-dimmer);
}

/* Retro Toggle Switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333333;
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid #222222;
}

[data-theme="light"] .slider {
  background-color: #CCCCCC;
  border-color: #BBBBBB;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--yellow);
  transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input:checked + .slider {
  background-color: #444444;
}

[data-theme="light"] input:checked + .slider {
  background-color: #999999;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.pink-switch input:checked + .slider:before {
  background-color: var(--pink);
}

.theme-toggle input:checked + .slider:before {
  background-color: var(--pink);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Server Status Pill */
.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-card);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-body);
}

.btn-settings:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background-color: #00E676; box-shadow: 0 0 6px #00E676; }
.status-dot.offline { background-color: #FF5252; box-shadow: 0 0 6px #FF5252; }

/* ═══════════════ RETRO CARDS ═══════════════ */
.card {
  background-color: var(--bg-card);
  border: 2px solid var(--border-card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 4px 12px var(--shadow-color);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-header {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.yellow-header { color: var(--yellow); }
[data-theme="light"] .yellow-header { color: #1A1A1A; }

.pink-header { color: var(--pink); }
[data-theme="light"] .pink-header { color: var(--deep-pink); }

.blue-header { color: var(--blue); }
[data-theme="light"] .blue-header { color: var(--dark-blue); }

.pink-text { color: var(--pink); }
.blue-text { color: var(--blue); }
[data-theme="light"] .blue-text { color: var(--dark-blue); }
.bold { font-weight: 700; }

.divider {
  height: 1px;
  background-color: var(--divider);
  width: 100%;
}

/* ═══════════════ RETRO BUTTONS ═══════════════ */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 14px 20px;
  border-radius: 12px;
  border: 2px solid var(--black);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 3px 3px 0px var(--black);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  user-select: none;
}

.btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0px var(--black);
}

.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--black);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-retro-pink {
  background-color: var(--pink);
  color: var(--white);
}

.btn-retro-yellow {
  background-color: var(--yellow);
  color: var(--black);
}

.btn-retro-blue {
  background-color: var(--blue);
  color: var(--black);
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-render {
  font-size: 1.25rem;
  padding: 18px;
}

/* ═══════════════ INPUTS & SELECTS ═══════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.retro-input, .retro-select {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 10px;
  color: var(--input-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
}

.retro-input:focus, .retro-select:focus {
  border-color: var(--pink);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 500px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Radio Pill Group */
.radio-pill-group {
  display: flex;
  gap: 6px;
}

.radio-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 8px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  user-select: none;
}

.radio-pill input {
  display: none;
}

.radio-pill:has(input:checked) {
  border-color: var(--yellow);
  background: rgba(255, 225, 77, 0.15);
  color: var(--yellow);
}

[data-theme="light"] .radio-pill:has(input:checked) {
  border-color: #1A1A1A;
  background: rgba(0, 0, 0, 0.08);
  color: #1A1A1A;
}

/* Color Picker Row */
.color-picker-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-swatch {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.color-input {
  max-width: 140px;
}

/* ═══════════════ SLIDERS ═══════════════ */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-value {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--yellow);
}

[data-theme="light"] .slider-value {
  color: #1A1A1A;
}

.retro-range {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #333333;
  outline: none;
  cursor: pointer;
}

[data-theme="light"] .retro-range {
  background: #DDDDDD;
}

.retro-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--black);
  cursor: pointer;
  box-shadow: 1px 1px 0px var(--black);
}

.pink-range::-webkit-slider-thumb {
  background: var(--pink);
}

.yellow-range::-webkit-slider-thumb {
  background: var(--yellow);
}

/* ═══════════════ TITLE PREVIEW CANVAS ═══════════════ */
.preview-box-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.preview-badge {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--yellow);
  letter-spacing: 0.5px;
}

.canvas-wrapper {
  width: 100%;
  background: #000000;
  border: 2px solid var(--black);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 2px 2px 0px var(--black);
  display: flex;
  justify-content: center;
  align-items: center;
}

#canvasTitlePreview {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
}

/* ═══════════════ MUSIC SECTION ═══════════════ */
.status-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
}

.mini-audio-player {
  width: 100%;
  height: 32px;
  margin-top: 4px;
}

.trim-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-row {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.radio-label input {
  accent-color: var(--pink);
}

.trim-sliders-box {
  background: var(--trim-box-bg);
  padding: 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.range-summary {
  font-size: 0.82rem;
}

.range-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ═══════════════ PHOTOS SECTION ═══════════════ */
.drop-zone {
  border: 2px dashed var(--blue);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  background: rgba(61, 212, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.2s, background-color 0.2s;
}

.drop-zone.dragover {
  border-color: var(--yellow);
  background: rgba(255, 225, 77, 0.1);
}

.drop-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Polaroid Photo Stack */
.photo-stack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.photo-card {
  position: relative;
  background: var(--polaroid-bg);
  border: 2px solid var(--polaroid-border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 2px 2px 0px var(--black);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.photo-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  background: var(--yellow);
  color: var(--black);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 900;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--black);
}

.photo-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-icon {
  background: #333333;
  color: var(--white);
  border: 1px solid var(--black);
  border-radius: 4px;
  font-size: 0.7rem;
  width: 22px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.btn-icon:hover {
  background: var(--yellow);
  color: var(--black);
}

.btn-delete {
  background: #E53935;
}

.btn-delete:hover {
  background: #FF5252;
  color: var(--white);
}

/* ═══════════════ RENDER PROGRESS ═══════════════ */
.progress-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-track {
  width: 100%;
  height: 14px;
  background: #2A2A2A;
  border: 2px solid var(--black);
  border-radius: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    45deg,
    var(--yellow) 25%,
    var(--pink) 25%,
    var(--pink) 50%,
    var(--yellow) 50%,
    var(--yellow) 75%,
    var(--pink) 75%
  );
  background-size: 28px 28px;
  animation: candy-stripes 1s linear infinite;
  transition: width 0.3s ease;
}

@keyframes candy-stripes {
  from { background-position: 0 0; }
  to { background-position: 28px 0; }
}

.render-status-text {
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-main);
}

/* ═══════════════ VIDEO PREVIEW ═══════════════ */
.video-preview-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rendered-video {
  width: 100%;
  max-height: 400px;
  border-radius: 12px;
  border: 2px solid var(--black);
  background: #000;
  box-shadow: 3px 3px 0px var(--black);
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
}

/* ═══════════════ SETTINGS MODAL ═══════════════ */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--modal-bg);
  z-index: 1000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.modal-action-btn {
  flex: 1;
  padding: 10px;
  font-size: 0.9rem;
}

.test-feedback {
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
}

.test-feedback.success {
  background: rgba(0, 230, 118, 0.15);
  color: #00E676;
  border: 1px solid #00E676;
}

.test-feedback.error {
  background: rgba(255, 82, 82, 0.15);
  color: #FF5252;
  border: 1px solid #FF5252;
}

/* ═══════════════ FOOTER ═══════════════ */
.footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dimmer);
  padding: 12px 0 24px 0;
}

.hidden {
  display: none !important;
}
