/* ── Advanced OTA Firmware Manager ── */
.ota-panel {
  background: var(--bg-card);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ota-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── File Dropzone ── */
.ota-drop {
  border: 2px dashed rgba(167, 139, 250, 0.25);
  border-radius: var(--r);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(0, 0, 0, 0.15);
}
.ota-drop:hover, .ota-drop.dragover {
  border-color: var(--purple);
  background: rgba(167, 139, 250, 0.04);
}
.ota-drop.has-file {
  border-color: var(--green);
  border-style: solid;
  background: rgba(52, 211, 153, 0.04);
}
.ota-drop-icon {
  font-size: 28px;
  margin-bottom: 6px;
}
.ota-drop-text {
  font-size: 12px;
  color: var(--txt2);
}
.ota-drop-info {
  font-size: 11px;
  color: var(--green);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

/* ── OTA Layout Grid & Target Selectors ── */
.ota-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}
.ota-column {
  min-width: 0;
}
.ota-targets-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ota-target-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--rs);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
}
.ota-target-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(56, 189, 248, 0.2);
}
.ota-target-item.selected {
  background: rgba(56, 189, 248, 0.07);
  border-color: rgba(56, 189, 248, 0.3);
}
.ota-seq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--txt3);
  background: rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  flex-shrink: 0;
  user-select: none;
}
.ota-seq-badge.selected {
  border-color: var(--blue);
  color: #000;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  font-weight: 800;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}
.ota-target-meta {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
}
.ota-target-name {
  font-weight: 600;
  color: var(--txt);
}
.ota-target-mac {
  font-family: 'JetBrains Mono', monospace;
  color: var(--txt2);
  margin-left: 6px;
}
.ota-target-ver {
  font-size: 8px;
  padding: 1px 4px;
  background: rgba(167, 139, 250, 0.12);
  color: var(--purple);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Firmware Library Grid & Cards ── */
.firmware-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.firmware-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--rs);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s;
  position: relative;
}
.firmware-card:hover {
  border-color: var(--brd-h);
  box-shadow: var(--glow);
  background: rgba(255, 255, 255, 0.03);
}
.fw-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.fw-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  word-break: break-all;
}
.fw-size {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--txt3);
  white-space: nowrap;
}
.fw-meta-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}
.fw-meta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.fw-meta-label {
  font-size: 9px;
  color: var(--txt3);
  text-transform: uppercase;
}
.fw-meta-val {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--txt2);
}
.fw-desc-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fw-desc-input {
  width: 100%;
  font-size: 10px;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--brd);
  border-radius: 4px;
  color: var(--txt);
  outline: none;
}
.fw-desc-input:focus {
  border-color: var(--purple);
}
.fw-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

/* ── Sequential Queue ── */
.ota-queue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  font-size: 11px;
}
.queue-target-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
}
.ota-seq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(167, 139, 250, 0.15);
  color: var(--purple);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}
.queue-status-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}
.queue-status-badge.pending { background: rgba(100, 116, 139, 0.15); color: var(--txt3); }
.queue-status-badge.probing { background: rgba(34, 211, 238, 0.2); color: var(--cyan); border: 1px solid rgba(34, 211, 238, 0.3); animation: pulseProbing 1.5s infinite; }
.queue-status-badge.running { background: rgba(56, 189, 248, 0.15); color: var(--blue); }
.queue-status-badge.canary_wait { background: rgba(251, 191, 36, 0.2); color: var(--amber); border: 1px solid rgba(251, 191, 36, 0.3); }
.queue-status-badge.completed { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.queue-status-badge.failed { background: rgba(248, 113, 113, 0.15); color: var(--red); }
.queue-status-badge.skipped { background: rgba(251, 191, 36, 0.15); color: var(--amber); }

@keyframes pulseProbing {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.98); }
}

/* ── Active Progress Bar ── */
.ota-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ota-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ota-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--purple);
}
.ota-status.success { color: var(--green); }
.ota-status.error { color: var(--red); }
.ota-percent {
  font-size: 18px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--purple);
}
.ota-bar-wrap {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.ota-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  background: linear-gradient(90deg, var(--blue), var(--purple), var(--blue));
  background-size: 200% 100%;
  animation: otaShimmer 2s linear infinite;
}
@keyframes otaShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.ota-bar.success { background: var(--green); animation: none; }
.ota-bar.error { background: var(--red); animation: none; }
.ota-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 10px;
  color: var(--txt2);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Schedule Form & Cards ── */
.ota-schedule-form-wrap {
  margin-top: 10px;
  animation: fadeIn 0.2s ease;
}
.ota-schedule-form {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: var(--rs);
  padding: 12px;
}
.schedule-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Schedule Target Items ── */
.sched-target-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--rs);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.sched-target-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(34, 211, 238, 0.25);
}
.sched-target-item.selected {
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.35);
}
.sched-target-item .ota-seq-badge.selected {
  border-color: var(--cyan);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #000;
  box-shadow: 0 0 5px rgba(34, 211, 238, 0.4);
}

.ota-schedules-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.schedule-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--rs);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
}
.schedule-card.enabled {
  border-color: rgba(34, 211, 238, 0.25);
  background: rgba(34, 211, 238, 0.02);
}
.schedule-card.disabled {
  opacity: 0.6;
}
.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.schedule-title {
  font-weight: 600;
  font-size: 11px;
  color: var(--txt);
}
.schedule-type-badge {
  font-size: 9px;
  padding: 1px 5px;
  background: rgba(167, 139, 250, 0.12);
  color: var(--purple);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
}
.schedule-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.schedule-status-dot.status-scheduled { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.schedule-status-dot.status-running { background: var(--blue); animation: pulseProbing 1s infinite; }
.schedule-status-dot.status-disabled { background: var(--txt3); }
.schedule-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 10px;
  color: var(--txt2);
}
.schedule-info-row strong {
  color: var(--txt);
}

/* ── OTA History Table ── */
.ota-history-table th {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ota-history-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 768px) {
  .ota-layout-grid { grid-template-columns: 1fr; }
}
