/* ===== MLAstro RPA — Firmware Update Tool Stylesheet ===== */

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

:root {
  --primary: #3498db;
  --primary-hover: #2980b9;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --dark: #2c3e50;
  --light: #f8f9fa;
  --gray: #95a5a6;

  /* Dark Theme Base (Default) */
  --bg-body: #0d1b2b;
  --bg-panel: #162433;
  --bg-card: #1c2e42;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d435c;
  --border-subtle: #1e3247;
  --header-bg: #0a1522;
  --header-text: #f1f5f9;
  --input-bg: #132030;
  --input-border: #334e6d;
}

/* Force Light Theme */
[data-theme="light"] {
  --bg-body: #f1f5f9;
  --bg-panel: #ffffff;
  --bg-card: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --border-subtle: #e2e8f0;
  --header-bg: #ffffff;
  --header-text: #1e293b;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
}

/* Force Dark Theme */
[data-theme="dark"] {
  --bg-body: #0d1b2b;
  --bg-panel: #162433;
  --bg-card: #1c2e42;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #2d435c;
  --border-subtle: #1e3247;
  --header-bg: #0a1522;
  --header-text: #f1f5f9;
  --input-bg: #132030;
  --input-border: #334e6d;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- SVG ICON SPRITE --- */
.ico-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ico {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- HEADER --- */
.header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 960px;
  margin: 0 auto;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-main);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.2s ease;
}

.header-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Theme selector */
#theme-select {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

#theme-select:hover {
  border-color: var(--primary);
}

/* Status Pill */
.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.pill-success {
  background: rgba(39, 174, 96, 0.15);
  color: var(--success);
  border: 1px solid rgba(39, 174, 96, 0.3);
}

.pill-warning {
  background: rgba(243, 156, 18, 0.15);
  color: var(--warning);
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.pill-danger {
  background: rgba(231, 76, 60, 0.15);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.pill-muted {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* --- MAIN CONTAINER --- */
.container {
  max-width: 960px;
  width: 100%;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

/* --- NOTICE CARDS --- */
.notice-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
}

.notice-icon {
  font-size: 22px;
  line-height: 1;
  margin-top: 2px;
}

.notice-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.notice-info {
  background: rgba(52, 152, 219, 0.1);
  border: 1px solid rgba(52, 152, 219, 0.3);
  color: var(--text-main);
}
.notice-info .notice-icon { color: var(--primary); }

.notice-warning {
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.3);
  color: var(--text-main);
}
.notice-warning .notice-icon { color: var(--warning); }

.notice-danger {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: var(--text-main);
}
.notice-danger .notice-icon { color: var(--danger); }

/* --- PANELS --- */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.panel-content {
  padding: 20px;
}

/* --- STEP LABELS & SECTIONS --- */
.section-block {
  margin-bottom: 24px;
}
.section-block:last-child {
  margin-bottom: 0;
}

.step-label {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text-main);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.step-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* --- VERSION LIST --- */
.version-list-box {
  max-height: 640px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--header-bg);
}

.version-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

.version-item:last-child {
  border-bottom: none;
}

.version-item:hover {
  background: rgba(52, 152, 219, 0.05);
}

/* Highlight the release whose radio is ticked */
.version-item.is-selected {
  background: rgba(52, 152, 219, 0.16);
  box-shadow: inset 3px 0 0 var(--primary);
}

.version-item.is-selected .version-num {
  color: var(--primary);
}

.version-item.is-selected:hover {
  background: rgba(52, 152, 219, 0.22);
}

.version-item input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--primary);
  cursor: pointer;
  width: 17px;
  height: 17px;
}

.version-info-box {
  flex: 1;
}

.version-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.version-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.version-date {
  font-size: 12px;
}

.version-meta {
  font-size: 12px;
  margin-top: 2px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.version-size:empty {
  display: none;
}

.version-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.version-meta code {
  color: var(--primary);
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-size: 11px;
}

/* Badges */
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
}

.badge-success {
  background: var(--success);
  color: #fff;
}

/* Loading & Empty states */
.loading-state,
.empty-state {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(52, 152, 219, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- USB FLASH DASHBOARD --- */
.usb-flash-container {
  margin-top: 10px;
}

.usb-flash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 24px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}

.usb-flash-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.usb-flash-summary {
  font-size: 15px;
  color: var(--text-main);
}

.usb-flash-action {
  margin: 6px 0;
}

.usb-flash-help {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.4;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* Inline messages */
.inline-message {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 14px;
  display: none;
}

.inline-message.msg-success {
  display: block;
  background: rgba(39, 174, 96, 0.12);
  border: 1px solid var(--success);
  color: var(--success);
}

.inline-message.msg-warning {
  display: block;
  background: rgba(243, 156, 18, 0.12);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.inline-message.msg-error {
  display: block;
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* --- OTA & TIPS PANEL --- */
.ota-intro {
  font-size: 14px;
  margin-bottom: 10px;
}

.ota-steps {
  margin-left: 20px;
  font-size: 13.5px;
  color: var(--text-muted);
  display: grid;
  gap: 6px;
}

.ota-steps code {
  color: var(--primary);
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.tips-content ul {
  margin-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 13.5px;
}

.tips-content a {
  color: var(--primary);
  text-decoration: none;
}
.tips-content a:hover {
  text-decoration: underline;
}

/* --- MODAL --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(520px, calc(100vw - 32px));
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  color: var(--text-main);
}

.close-modal {
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.close-modal:hover {
  color: var(--danger);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 14px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- FOOTER --- */
.footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--header-bg);
  margin-top: 40px;
}

.footer a {
  color: inherit;
  text-decoration: none;
}
.footer a:hover {
  color: var(--primary);
}

/* Utility */
.hidden {
  display: none !important;
}

.text-muted {
  color: var(--text-muted);
}

.text-danger {
  color: var(--danger);
}

/* Mobile responsive */
@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-tools {
    width: 100%;
    justify-content: space-between;
  }
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
