/* MorningChecker Long-Test Monitor - Component Stylesheet */

/* Cards & Glass Panels */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  backdrop-filter: var(--glass-blur);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.glass-panel {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: var(--glass-blur);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-online {
  background: rgba(16, 185, 129, 0.12);
  color: var(--status-online);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-online .badge-dot { background: var(--status-online); box-shadow: 0 0 6px var(--status-online-glow); }

.badge-testing {
  background: rgba(6, 182, 212, 0.12);
  color: var(--status-testing);
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-testing .badge-dot { background: var(--status-testing); box-shadow: 0 0 6px var(--status-testing-glow); }

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.badge-danger .badge-dot { background: var(--status-red); box-shadow: 0 0 6px var(--status-red-glow); }

.badge-amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--status-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-amber .badge-dot { background: var(--status-amber); box-shadow: 0 0 6px var(--status-amber-glow); }

.badge-offline {
  background: rgba(100, 116, 139, 0.12);
  color: var(--status-gray);
  border: 1px solid rgba(100, 116, 139, 0.25);
}
.badge-offline .badge-dot { background: var(--status-gray); }

.badge-purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--status-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.badge-purple .badge-dot { background: var(--status-purple); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 14px;
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #0284C7);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0EA5E9, #0369A1);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-light);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, var(--status-online), #059669);
  color: #fff;
  box-shadow: 0 4px 12px var(--status-online-glow);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, var(--status-amber), #D97706);
  color: #fff;
  box-shadow: 0 4px 12px var(--status-amber-glow);
}
.btn-warning:hover {
  background: linear-gradient(135deg, #D97706, #B45309);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--status-red), #DC2626);
  color: #fff;
  box-shadow: 0 4px 12px var(--status-red-glow);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #DC2626, #B91C1C);
  transform: translateY(-1px);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}

/* Device Group Aging Card (Crucial Feature Requirement) */
.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: var(--transition);
  backdrop-filter: var(--glass-blur);
}

.device-card.selected {
  border-color: rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.18), var(--shadow-md) !important;
  background: rgba(14, 25, 45, 0.92) !important;
}

.card-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  border-radius: 4px;
  margin: 0;
  transition: var(--transition);
}

.device-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
  transition: var(--transition);
}

/* Card Top Glow Bar per Device Aging/Online Status */
.device-card.status-testing::before {
  background: linear-gradient(90deg, var(--status-testing), var(--primary));
  box-shadow: 0 0 10px var(--status-testing-glow);
}

.device-card.status-completed::before {
  background: linear-gradient(90deg, var(--status-online), #34D399);
  box-shadow: 0 0 10px var(--status-online-glow);
}

.device-card.status-stopped::before {
  background: linear-gradient(90deg, var(--status-amber), #FBBF24);
  box-shadow: 0 0 10px var(--status-amber-glow);
}

.device-card.status-fault::before {
  background: linear-gradient(90deg, var(--status-red), #F87171);
  box-shadow: 0 0 12px var(--status-red-glow);
}

.device-card.status-offline::before {
  background: var(--status-gray);
  opacity: 0.5;
}

.device-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.device-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-sn-title {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-mac-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* Aging Progress Bar & Indicators */
.aging-progress-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

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

.progress-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--status-testing), var(--primary));
  position: relative;
  transition: width 0.4s ease;
}

.progress-fill.completed {
  background: linear-gradient(90deg, var(--status-online), #34D399);
}

.progress-fill.stopped {
  background: linear-gradient(90deg, var(--status-amber), #FBBF24);
}

.progress-fill.fault {
  background: linear-gradient(90deg, var(--status-red), #F87171);
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(
    90deg, 
    rgba(255,255,255,0) 0%, 
    rgba(255,255,255,0.3) 50%, 
    rgba(255,255,255,0) 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Firmware Version Full-Width Banner */
.device-fw-bar {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.fw-bar-label {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fw-bar-val {
  font-family: var(--font-mono);
  color: #38BDF8;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Hardware & Aging Test Metrics Grid */
.hw-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Crash Warning Badge on Card */
.broken-alert-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--status-red);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  animation: alert-glow 1.5s infinite alternate;
}

@keyframes alert-glow {
  0% { box-shadow: 0 0 4px rgba(239, 68, 68, 0.2); }
  100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.6); }
}

/* Card Action Footer */
.device-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

select.form-control option {
  background: #0F172A;
  color: #fff;
}

/* Data Table */
.table-container {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: var(--glass-blur);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 18px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Modal Overlay & Dialog */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #0F172A;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
  transform: scale(0.95);
  transition: var(--transition);
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: #fff; }

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast System */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  backdrop-filter: var(--glass-blur);
  animation: slideInRight 0.3s ease forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-color: var(--status-online); color: var(--status-online); }
.toast-error { border-color: var(--status-red); color: var(--status-red); }
.toast-info { border-color: var(--primary); color: var(--primary); }
.toast-warning { border-color: var(--status-amber); color: var(--status-amber); }
