/* HA Volume Knob Flash Tool — style.css
   Colour palette mirrors the firmware UI: ocean teal, sunset orange, golden yellow */

:root {
  --bg:         #0a0c0e;
  --surface:    #111418;
  --surface2:   #1a1f26;
  --border:     #22292f;
  --teal:       #1aa5a5;
  --teal-dim:   #0d6060;
  --orange:     #e07a40;
  --gold:       #d4a830;
  --white:      #e8e2d6;
  --muted:      #6a7480;
  --red:        #c0392b;
  --green:      #27ae60;
  --radius:     8px;
  --font-mono:  "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --font-sans:  "Inter", system-ui, sans-serif;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
  padding: 24px 16px 48px;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
header { text-align: center; padding: 8px 0 4px; }
header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--teal), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* Connect bar */
.connect-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.chip-info {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--teal);
}

/* Buttons */
.btn {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:not(:disabled):hover { opacity: 0.85; }
.btn:not(:disabled):active { transform: scale(0.97); }

.btn-primary  { background: var(--teal);   color: #000; }
.btn-secondary { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.btn-accent   { background: var(--gold);   color: #000; }
.btn-small {
  cursor: pointer;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  transition: color 0.15s;
}
.btn-small:hover { color: var(--white); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  cursor: pointer;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--white); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card h2 { font-size: 1.1rem; font-weight: 600; color: var(--white); }
.description { font-size: 0.88rem; color: var(--muted); line-height: 1.55; }

/* Firmware info */
.firmware-info { font-size: 0.85rem; }
.firmware-ok, .firmware-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
}
.firmware-ok   { background: rgba(39, 174, 96, 0.12); color: var(--green); }
.firmware-warn { background: rgba(224, 122, 64, 0.12); color: var(--orange); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.ok   { background: var(--green); }
.dot.warn { background: var(--orange); }
.loading { color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; }
.firmware-warn code {
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Form */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.help-link {
  color: var(--teal-dim);
  text-decoration: none;
  font-size: 0.75rem;
  border: 1px solid var(--teal-dim);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
input, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}
input:focus, textarea:focus { border-color: var(--teal); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.6; }

.actions { display: flex; justify-content: flex-end; }

/* Progress */
.progress-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.progress-label { font-size: 0.82rem; color: var(--muted); font-family: var(--font-mono); }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* Log */
.log-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
#log-output {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--teal);
  background: #070a0c;
  padding: 12px 14px;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* Serial Monitor */
.monitor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.monitor-baud-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}
#monitor-baud {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
}
#monitor-baud:focus { border-color: var(--teal); }
.monitor-output {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #4dff91;
  background: #070a0c;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

@media (max-width: 480px) {
  body { padding: 12px 8px 32px; }
  .card { padding: 16px; }
  .connect-bar { flex-wrap: wrap; }
}
