/* PCI Bridge Admin Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  color: #333;
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: #1a1a2e;
  color: #ccc;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.2s ease;
}

.sidebar.collapsed {
  transform: translateX(-240px);
}

.sidebar-header {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h1 {
  margin: 0;
  font-size: 1.2em;
  color: white;
  white-space: nowrap;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  padding: 12px 20px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 20px;
  color: #adb5bd;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: white;
}

.nav-item.active {
  background: rgba(67, 97, 238, 0.15);
  color: #7b8cff;
  border-right: 3px solid #4361ee;
}

.nav-icon {
  width: 24px;
  text-align: center;
  margin-right: 10px;
  font-size: 15px;
}

.nav-label {
  white-space: nowrap;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

.main-content.expanded {
  margin-left: 0;
}

.topbar {
  background: white;
  border-bottom: 1px solid #e9ecef;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-toggle {
  background: none;
  border: 1px solid #dee2e6;
  color: #495057;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  display: none;
}

.topbar-toggle:hover {
  background: #f8f9fa;
}

.main-content.expanded .topbar-toggle {
  display: inline-block;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.admin-container-wide {
  max-width: none;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-240px);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .topbar-toggle {
    display: inline-block !important;
  }
}

.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 20px;
  margin-bottom: 20px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

table th {
  background: #f8f9fa;
  font-weight: 600;
  white-space: nowrap;
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: #4361ee;
  color: white;
}

.btn-primary:hover {
  background: #3a56d4;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-success {
  background: #2ec4b6;
  color: white;
}

.btn-danger {
  background: #e63946;
  color: white;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.form-group textarea {
  min-height: 100px;
}

.flash-notice {
  background: #d4edda;
  color: #155724;
  padding: 10px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.flash-alert {
  background: #f8d7da;
  color: #721c24;
  padding: 10px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: #d4edda;
  color: #155724;
}

.badge-inactive {
  background: #f8d7da;
  color: #721c24;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h2 {
  margin: 0;
}

.log-page-header h2 {
  margin-top: 16px;
}

.log-section h3 {
  margin: 0 0 8px;
}

.log-route {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 6px;
  background: #f1f3f5;
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.log-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
}

.log-status-summary strong {
  margin-right: 6px;
}

.log-failure-summary {
  padding: 12px 16px;
  margin-top: 16px;
  border-left: 4px solid #dc3545;
  border-radius: 4px;
  background: #fdf0f1;
  color: #721c24;
}

.log-metadata-details {
  margin-top: 16px;
}

.log-metadata-details summary {
  cursor: pointer;
  color: #495057;
  font-weight: 600;
}

.log-metadata-details[open] summary {
  margin-bottom: 12px;
}

.log-metadata th {
  width: 190px;
}

.parent-request-card .btn {
  margin-top: 16px;
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #dee2e6;
}

.tab-link {
  padding: 10px 20px;
  text-decoration: none;
  color: #6c757d;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-link:hover {
  color: #333;
  border-bottom-color: #adb5bd;
}

.tab-link.active {
  color: #4361ee;
  border-bottom-color: #4361ee;
}

/* Form rows */
.form-row {
  display: flex;
  gap: 16px;
}

.form-group-half {
  flex: 1;
}

/* Test results */
.step-result {
  margin-bottom: 16px;
}

.step-result h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
}

.result-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
}

.status-success {
  background: #d4edda;
  color: #155724;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
}

.result-detail {
  margin-bottom: 10px;
}

.result-detail strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #555;
}

.result-detail code {
  background: #f1f3f5;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 13px;
}

.code-block {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 4px 0 0 0;
}

.text-muted {
  color: #999;
  font-style: italic;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group-inline label {
  display: inline;
  margin-bottom: 0;
}

.form-group-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Form section headers */
.form-section-header {
  font-size: 18px;
  font-weight: 700;
  color: #222;
  border-bottom: 2px solid #4361ee;
  padding-bottom: 8px;
  margin: 28px 0 16px 0;
}

.form-section-header:first-of-type {
  margin-top: 0;
}

/* Environment caption */
.sidebar-env-label {
  font-size: 11px;
  color: #adb5bd;
  font-weight: 400;
  margin-top: 2px;
}

/* Progress indicator / spinner */
.progress-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #e8f0fe;
  border-radius: 6px;
  color: #1a56db;
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid #93b4f5;
  border-top-color: #1a56db;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Timing summary */
.timing-summary h4 {
  margin: 0 0 8px 0;
}

.timing-summary table td,
.timing-summary table th {
  font-size: 13px;
  padding: 7px 10px;
}
