/* Common styles shared across all pages */

/* Layout */
body {
  font-family: system-ui, sans-serif;
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

/* Typography */
h1 {
  margin-bottom: 10px;
}

p {
  margin: 0 0 10px;
}

/* Navigation */
nav {
  margin: 20px 0;
  padding: 10px 0;
  border-bottom: 2px solid;
}

nav a {
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
}

nav a.active {
  font-weight: 500;
}

/* Buttons */
button {
  padding: 8px 16px;
  font-size: 14px;
  border: 1px solid;
  border-radius: 4px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form elements */
input,
select {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  border: 1px solid;
  border-radius: 4px;
  box-sizing: border-box;
}

input:disabled,
select:disabled {
  opacity: 0.5;
}

/* Sections */
section {
  margin: 20px 0;
  padding: 20px;
  border-radius: 8px;
}

/* Pre/Code blocks */
pre {
  padding: 15px;
  border-radius: 4px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

/* ================================
   LIGHT THEME
   ================================ */
body.light {
  background: #fff;
  color: #333;
}

body.light p.subtitle {
  color: #666;
}

body.light nav {
  border-bottom-color: #e0e0e0;
}

body.light nav a {
  color: #0066cc;
}

body.light nav a:hover {
  background: #f0f0f0;
}

body.light nav a.active {
  background: #e8f4f8;
}

body.light section {
  background: #f5f5f5;
}

body.light input,
body.light select {
  border-color: #ccc;
}

body.light button {
  border-color: #ccc;
}

/* Flash page specific - light theme */
body.light .firmware-selector {
  background: #f9f9f9;
  border-color: #ccc;
}

body.light .config-toggle {
  background: #e8f4f8;
  border: 2px solid #0066cc;
}

body.light #flash-btn {
  background: #0066cc;
  color: white;
  border: none;
}

body.light #flash-btn:hover:not(:disabled) {
  background: #0052a3;
}

body.light #log {
  background: #1e1e1e;
  color: #d4d4d4;
}

body.light .error {
  color: #ff4444;
}

body.light .success {
  color: #44ff44;
}

body.light .controls {
  background: #e8f4f8;
}

body.light button.disconnect {
  background: #c72e2e;
  color: white;
}

/* ================================
   DARK THEME
   ================================ */
body.dark {
  background: #1e1e1e;
  color: #d4d4d4;
}

body.dark h1 {
  color: #fff;
}

body.dark p {
  color: #aaa;
}

body.dark nav {
  border-bottom-color: #3c3c3c;
}

body.dark nav a {
  color: #58a6ff;
}

body.dark nav a:hover {
  background: #2d2d2d;
}

body.dark nav a.active {
  background: #0e4273;
}

body.dark input,
body.dark select,
body.dark button {
  background: #3c3c3c;
  color: #d4d4d4;
  border-color: #555;
}

body.dark button:hover:not(:disabled) {
  background: #4c4c4c;
}

/* Flash page specific - dark theme */
body.dark .firmware-selector {
  background: #2d2d2d;
  border-color: #555;
}

/* Monitor page specific - dark theme */
body.dark .controls {
  background: #2d2d2d;
}

body.dark button.connected {
  background: #0e639c;
}

body.dark button.disconnect {
  background: #c72e2e;
}

body.dark #output {
  background: #0c0c0c;
  color: #0f0;
  border: 1px solid #333;
}

body.dark input[type="text"] {
  background: #2d2d2d;
  font-family: 'Courier New', monospace;
}

/* ================================
   PAGE-SPECIFIC LAYOUTS
   ================================ */

/* Flash page config form */
.firmware-selector {
  margin-bottom: 20px;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid;
}

.firmware-notes {
  margin: 8px 0 0 0;
  font-size: 13px;
  opacity: 0.8;
  font-style: italic;
}

.config-toggle {
  margin-bottom: 15px;
  padding: 10px 12px;
  border-radius: 4px;
}

.config-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
}

.config-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.config-hint {
  margin: 6px 0 0 0;
  padding-left: 0;
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.3;
}

.config-fields {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.config-fields.hidden {
  display: none !important;
}

.full-width {
  grid-column: 1 / -1;
}

label.field-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 13px;
}

#flash-btn {
  font-weight: bold;
  width: 100%;
  padding: 12px 24px;
  font-size: 15px;
}

#status {
  margin: 10px 0;
  font-weight: 500;
}

#log {
  max-height: 250px;
  font-family: monospace;
  font-size: 12px;
}

/* Monitor page controls */
.controls {
  margin: 20px 0;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.controls select,
.controls button {
  width: auto;
}

#output {
  height: 600px;
  word-break: break-all;
  background: #0c0c0c;
  color: #0f0;
  border: 1px solid #333;
}

.input-group {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.input-group input[type="text"] {
  flex: 1;
  width: auto;
  font-family: 'Courier New', monospace;
}

.input-group select,
.input-group button {
  width: auto;
}
