/* Machines Panel — Sovereign Fleet Inventory */

/* ── Fleet Summary Header ── */
.machines-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
  padding: 0 4px;
}
.machines-summary .summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.machines-summary .summary-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00d4ff, #0088ff);
}
.summary-card .summary-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.summary-card .summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.summary-card .summary-icon {
  font-size: 20px;
  margin-bottom: 8px;
  display: block;
}

/* ── Machine Cards Grid ── */
.machines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  padding: 0 4px;
}

.machine-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.machine-card:hover {
  transform: translateY(-2px);
  border-color: #00d4ff44;
}
.machine-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 14px;
  pointer-events: none;
  transition: box-shadow 0.3s ease;
}
/* Sovereignty glow */
.machine-card.sov-red::before { box-shadow: inset 0 0 30px rgba(255, 60, 60, 0.08), 0 0 20px rgba(255, 60, 60, 0.06); }
.machine-card.sov-red { border-color: rgba(255, 60, 60, 0.25); }
.machine-card.sov-yellow::before { box-shadow: inset 0 0 30px rgba(255, 200, 0, 0.08), 0 0 20px rgba(255, 200, 0, 0.06); }
.machine-card.sov-yellow { border-color: rgba(255, 200, 0, 0.25); }
.machine-card.sov-green::before { box-shadow: inset 0 0 30px rgba(0, 212, 100, 0.08), 0 0 20px rgba(0, 212, 100, 0.06); }
.machine-card.sov-green { border-color: rgba(0, 212, 100, 0.25); }

.machine-card.pending {
  opacity: 0.45;
  filter: grayscale(0.6);
  pointer-events: none;
}
.machine-card.pending::after {
  content: 'PENDING DISCOVERY';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Card header */
.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.mc-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.mc-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.mc-status.discovered { background: #ff6b6b22; color: #ff6b6b; }
.mc-status.encrypting { background: #feca5722; color: #feca57; }
.mc-status.protected { background: #00d46422; color: #00d464; }
.mc-status.wiped { background: #8b949e22; color: #8b949e; }

/* Card specs */
.mc-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.mc-spec {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Storage bars */
.mc-storage {
  margin-bottom: 14px;
}
.mc-disk {
  margin-bottom: 8px;
}
.mc-disk-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}
.mc-disk-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}
.mc-disk-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.mc-disk-fill.low { background: linear-gradient(90deg, #00d464, #00d464); }
.mc-disk-fill.medium { background: linear-gradient(90deg, #feca57, #ff9f43); }
.mc-disk-fill.high { background: linear-gradient(90deg, #ff6b6b, #ee5a24); }

/* Card footer row */
.mc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.mc-files {
  font-size: 12px;
  color: var(--text-secondary);
}
.mc-files strong {
  color: var(--text-primary);
}

/* Sovereignty ring */
.mc-sov-ring {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.mc-sov-ring svg {
  width: 100%;
  height: 100%;
}
.sov-ring-bg { fill: none; stroke: var(--border); stroke-width: 4; opacity: 0.4; }
.sov-ring-fg { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray 0.8s ease, stroke 0.3s ease; }
.sov-ring-text { fill: var(--text-primary); font-size: 11px; font-weight: 800; }
.sov-ring-label { fill: var(--text-secondary); font-size: 5px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Machine Detail (expanded) ── */
.machine-detail-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.machine-detail-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.machine-detail {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}
.machine-detail::-webkit-scrollbar { width: 6px; }
.machine-detail::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.md-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.md-close:hover { background: var(--bg-primary); color: var(--text-primary); }

.md-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.md-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}

.md-section {
  margin-bottom: 20px;
}
.md-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #00d4ff;
  margin-bottom: 10px;
}
.md-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.md-item {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.md-item strong { color: var(--text-primary); }

/* Detail storage bars (wider) */
.md-disk { margin-bottom: 10px; }
.md-disk-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.md-disk-bar {
  height: 10px;
  background: var(--bg-primary);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.md-disk-fill {
  height: 100%;
  border-radius: 5px;
}

/* Action buttons */
.md-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.md-action-btn {
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.md-action-btn:hover {
  border-color: #00d4ff;
  background: #00d4ff11;
}
.md-action-btn.danger {
  border-color: #ff4444;
  color: #ff6b6b;
}
.md-action-btn.danger:hover {
  background: #ff444422;
  border-color: #ff6b6b;
}

/* ── Full Reset Modal ── */
.reset-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.reset-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.reset-modal {
  background: var(--bg-secondary);
  border: 2px solid #ff4444;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  padding: 32px;
  text-align: center;
}
.reset-modal .reset-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.reset-modal .reset-title {
  font-size: 22px;
  font-weight: 800;
  color: #ff6b6b;
  margin-bottom: 12px;
}
.reset-modal .reset-warning {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.reset-modal .reset-confirm-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
  font-family: monospace;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.reset-modal .reset-confirm-input:focus { border-color: #ff4444; }
.reset-modal .reset-confirm-input.matched { border-color: #ff6b6b; }
.reset-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.reset-btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.reset-btn-cancel {
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
}
.reset-btn-confirm {
  padding: 10px 24px;
  border: 2px solid #ff4444;
  border-radius: 10px;
  background: #ff444422;
  color: #ff6b6b;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.4;
  pointer-events: none;
  transition: all 0.2s;
}
.reset-btn-confirm.enabled {
  opacity: 1;
  pointer-events: all;
}
.reset-btn-confirm.enabled:hover {
  background: #ff4444;
  color: #fff;
}

/* Reset progress */
.reset-progress {
  text-align: left;
}
.reset-phase {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.reset-phase-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all 0.3s;
}
.reset-phase.active .reset-phase-icon { border-color: #00d4ff; color: #00d4ff; }
.reset-phase.done .reset-phase-icon { border-color: #00d464; color: #00d464; background: #00d46422; }
.reset-phase-info { flex: 1; }
.reset-phase-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.reset-phase.active .reset-phase-name { color: var(--text-primary); }
.reset-phase.done .reset-phase-name { color: #00d464; }
.reset-phase-bar {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.reset-phase-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #00d4ff, #0088ff);
  transition: width 0.3s ease;
}
.reset-phase.done .reset-phase-fill { width: 100%; background: #00d464; }

/* Reset complete */
.reset-complete {
  text-align: center;
  padding: 20px 0;
}
.reset-complete .complete-icon { font-size: 56px; margin-bottom: 16px; }
.reset-complete .complete-title {
  font-size: 20px;
  font-weight: 800;
  color: #00d464;
  margin-bottom: 8px;
}
.reset-complete .complete-msg {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.reset-complete .complete-close {
  margin-top: 24px;
  padding: 10px 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .machines-grid {
    grid-template-columns: 1fr;
  }
  .machines-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .machine-detail {
    padding: 20px;
    max-height: 90vh;
  }
  .md-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .machines-summary {
    grid-template-columns: 1fr;
  }
}
