/* ================================================================
   VCKTOR FORGE — Stylesheet
   Dark + pixel + orange accent, kept minimal and clean.
   ================================================================ */

:root {
  --bg:         #080808;
  --bg-panel:   #0f0f0f;
  --bg-input:   #161616;
  --bg-hover:   #1a1a1a;
  --border:     #222;
  --border-hi:  #333;
  --text:       #bbb;
  --text-dim:   #666;
  --text-bright:#eee;
  --accent:     #ff5500;
  --accent-dim: #993300;
  --danger:     #cc2222;
  --success:    #22aa44;
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono:  'SF Mono', 'Fira Code', 'Consolas', monospace;
  --radius:     2px;
}

*, *::before, *::after { 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;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ================================================================
   AUTH GATE
   ================================================================ */
.auth-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1000;
}
.auth-box {
  text-align: center;
  width: 280px;
}
.auth-title {
  font-family: var(--font-pixel);
  font-size: 20px;
  color: var(--text-bright);
  letter-spacing: -0.05em;
  line-height: 1.6;
  margin-bottom: 4px;
}
.auth-sub {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 32px;
}
.auth-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.3em;
  border-radius: var(--radius);
  outline: none;
  margin-bottom: 12px;
}
.auth-input:focus { border-color: var(--accent); }
.auth-btn { width: 100%; }
.auth-error {
  color: var(--danger);
  font-size: 10px;
  margin-top: 8px;
  min-height: 16px;
}

/* ================================================================
   HEADER
   ================================================================ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.logo {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--text-bright);
  letter-spacing: -0.05em;
}
.logo-accent {
  color: var(--accent);
  margin-left: 2px;
}
.nav { display: flex; gap: 2px; }
.nav-btn {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.05em;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

.header-right { display: flex; align-items: center; }
.gpu-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
}
.gpu-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}
.gpu-dot.active { background: var(--success); }
.gpu-name { font-size: 10px; }

/* ================================================================
   TABS
   ================================================================ */
.tab-content {
  display: none;
  padding: 20px;
  min-height: calc(100vh - 48px - 36px);
}
.tab-content.active { display: block; }

/* ================================================================
   PANELS
   ================================================================ */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.panel-title {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 16px;
}

/* ================================================================
   FORM ELEMENTS
   ================================================================ */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.field-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 6px;
}
.field-row {
  display: flex;
  gap: 6px;
}
.field-row .select { flex: 1; }
.field-row-2 {
  display: flex;
  gap: 12px;
}
.field-row-2 .field { flex: 1; }

.input, .select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--radius);
  outline: none;
}
.input:focus, .select:focus { border-color: var(--accent); }
.select { cursor: pointer; }
.select option { background: var(--bg-input); }
.select-sm { padding: 6px 8px; font-size: 11px; }

.input-file {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}
.input-file::file-selector-button {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  margin-right: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
}

/* ---- Buttons ---- */
.btn {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  transition: all 0.12s;
}
.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hi);
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-sm {
  font-size: 8px;
  padding: 6px 10px;
}
.btn-full { width: 100%; }

/* ---- Sliders ---- */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  margin: 6px 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 2px;
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent);
  border: 2px solid var(--bg);
  border-radius: 2px;
  cursor: pointer;
}

/* ================================================================
   TRAIN TAB
   ================================================================ */
.train-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  max-width: 1200px;
}

/* ---- Log ---- */
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.log-header .panel-title { margin-bottom: 0; }

.status-badge {
  font-family: var(--font-pixel);
  font-size: 8px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
.status-badge.active {
  border-color: var(--accent);
  color: var(--accent);
  animation: pulse-border 2s steps(1) infinite;
}
.status-badge.done {
  border-color: var(--success);
  color: var(--success);
}
.status-badge.error {
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: var(--accent-dim); }
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.progress-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s steps(20);
}
.progress-text {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text-dim);
  min-width: 36px;
  text-align: right;
}

.epoch-info {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
  min-height: 18px;
}

.log-area {
  height: 420px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
}
.log-placeholder {
  color: var(--text-dim);
  font-size: 11px;
  opacity: 0.5;
}

/* ================================================================
   CONVERT TAB
   ================================================================ */
.convert-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  max-width: 1200px;
}

.param-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 16px;
}
.param label {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
.param-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  float: right;
}

/* ---- Drop Zone ---- */
.drop-zone {
  border: 1px dashed var(--border-hi);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(255, 85, 0, 0.03);
}
.drop-zone p {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.drop-hint {
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  margin-top: 6px;
  opacity: 0.4;
}
.drop-zone-sm { padding: 18px 12px; }

.file-name {
  font-size: 11px;
  color: var(--text);
  margin-top: 6px;
  word-break: break-all;
}
.file-list {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  max-height: 120px;
  overflow-y: auto;
}
.file-list-item {
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
}

/* ---- Output ---- */
.convert-status {
  min-height: 20px;
  margin-bottom: 8px;
}
.convert-status .spinner {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--accent);
  letter-spacing: 0.1em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.convert-result audio {
  width: 100%;
  margin: 8px 0;
  outline: none;
}
.convert-result .result-item {
  padding: 10px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg);
}
.result-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.result-name {
  font-size: 11px;
  color: var(--text);
}
.result-actions { display: flex; gap: 6px; }

.convert-history {
  margin-top: 16px;
}
.convert-history h3 {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

/* ================================================================
   MODELS TAB
   ================================================================ */
.models-layout {
  max-width: 1200px;
}
.models-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.models-header .panel-title { margin-bottom: 0; }

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.model-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.model-card:hover { border-color: var(--border-hi); }
.model-card-name {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--text-bright);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.model-card-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.model-card-size {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.model-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ================================================================
   HISTORY TAB
   ================================================================ */
.history-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  max-width: 1200px;
}
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.history-header .panel-title { margin-bottom: 0; }
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.history-row.current { background: var(--bg-panel); }
.history-row.active,
.model-card-active {
  border-color: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(255, 85, 0, 0.08);
}
.history-main { flex: 1; min-width: 0; }
.history-name {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--text-bright);
  margin-bottom: 8px;
  word-break: break-all;
}
.history-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.history-side {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.history-error {
  color: var(--danger);
  font-size: 10px;
  margin-top: 6px;
}
.history-log {
  margin-top: 12px;
  padding: 10px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.6;
  word-break: break-all;
}
.mini-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  margin-top: 8px;
  overflow: hidden;
}
.mini-progress > div {
  height: 100%;
  background: var(--accent);
}

/* ================================================================
   MODAL
   ================================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 20px;
  width: 400px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--text-bright);
  letter-spacing: 0.1em;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }

/* ================================================================
   FOOTER
   ================================================================ */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 36px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-text {
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.5;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 800px) {
  .train-layout,
  .convert-layout,
  .history-layout {
    grid-template-columns: 1fr;
  }
  .log-area { height: 300px; }
  .param-grid { grid-template-columns: 1fr; }
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }
  .header-right { display: none; }
}
