/* ==========================================================================
   Titan4 Pipeline Debug - Shared Design System
   ========================================================================== */

/* --- CSS Variables --- */
:root {
  /* Brand */
  --brand-dark: #0A1628;
  --brand-accent: #C9D61D;
  --brand-accent-hover: #b8c21a;

  /* Backgrounds */
  --bg-page: #f9fafb;
  --bg-card: #ffffff;

  /* Borders */
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  /* Status */
  --status-running: #facc15;
  --status-completed: #22c55e;
  --status-failed: #ef4444;
  --status-pending: #3b82f6;
  --status-cancelled: #9ca3af;
  --status-reserved: #4f46e5;

  /* Legacy compat */
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
}

/* --- Base --- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  margin: 0;
}

/* --- Navbar --- */
.navbar-dark {
  background: var(--brand-dark);
  padding: 0;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.navbar-dark .navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.navbar-dark .nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-dark .nav-brand img {
  height: 32px;
  width: auto;
}

.navbar-dark .nav-brand-text {
  color: var(--brand-accent);
  font-size: 0.875rem;
  font-weight: 500;
  align-self: flex-end;
}

.navbar-dark .nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Bell icon */
.nav-bell {
  position: relative;
  padding: 0.5rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: background 0.15s;
  display: flex;
  align-items: center;
}

.nav-bell:hover {
  background: rgba(255,255,255,0.1);
}

.nav-bell .bell-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--brand-accent);
  border-radius: 50%;
}

/* Avatar */
.nav-avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.15s;
}

.nav-avatar-btn:hover {
  background: rgba(255,255,255,0.1);
}

.nav-avatar {
  width: 36px;
  height: 36px;
  background: var(--brand-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-avatar span {
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 0.875rem;
}

/* Profile dropdown */
.nav-profile {
  position: relative;
}

.profile-dropdown {
  display: none;
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  width: 260px;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  border: 1px solid var(--border-color);
  z-index: 1000;
  overflow: hidden;
}

.profile-dropdown.show {
  display: block;
}

.profile-dropdown .profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.profile-dropdown .profile-header .avatar-lg {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: var(--brand-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-dropdown .profile-header .avatar-lg span {
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 1rem;
}

.profile-dropdown .profile-header .profile-info {
  min-width: 0;
  flex: 1;
}

.profile-dropdown .profile-header .profile-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown .profile-header .profile-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown .dropdown-menu-items {
  padding: 0.5rem 0;
}

.profile-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.profile-dropdown .dropdown-item:hover {
  background: var(--bg-page);
}

.profile-dropdown .dropdown-divider {
  border-top: 1px solid var(--border-color);
  margin: 0;
  padding-top: 0.5rem;
}

/* --- Buttons --- */
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  background: var(--brand-accent);
  color: var(--brand-dark);
  border: none;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-accent:hover {
  background: var(--brand-accent-hover);
  color: var(--brand-dark);
  text-decoration: none;
}

.btn-accent.disabled, .btn-accent:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  background: var(--brand-dark);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-dark:hover {
  background: #0d1f38;
  color: white;
  text-decoration: none;
}

.btn-dark.disabled, .btn-dark:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-outline-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  background: transparent;
  color: var(--brand-dark);
  border: 2px solid var(--brand-dark);
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-outline-dark:hover {
  background: var(--bg-page);
  color: var(--brand-dark);
  text-decoration: none;
}

.btn-outline-dark.disabled, .btn-outline-dark:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-outline-gray {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-outline-gray:hover {
  background: var(--bg-page);
  text-decoration: none;
}

.btn-outline-gray.disabled, .btn-outline-gray:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-outline-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  background: transparent;
  color: var(--status-failed);
  border: 1px solid #fca5a5;
  border-radius: 0.375rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-outline-red:hover {
  background: #fef2f2;
  text-decoration: none;
}

.btn-outline-red.disabled, .btn-outline-red:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Badges --- */
.badge-sensor {
  font-size: 0.875rem;
  font-weight: 600;
}

.badge-sensor-s1, .badge-sensor-s2 { color: #2563eb; }
.badge-sensor-csk { color: #dc2626; }
.badge-sensor-saocom { color: #16a34a; }

.badge-orbit {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.badge-orbit-asc { background: #f3e8ff; color: #7c3aed; }
.badge-orbit-desc { background: #ccfbf1; color: #0d9488; }

/* --- Status Indicators --- */
.status-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-dot .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.status-dot .dot-ping {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  0% { transform: scale(1); opacity: 0.75; }
  75%, 100% { transform: scale(2); opacity: 0; }
}

.dot-running { background: var(--status-running); }
.dot-completed, .dot-green { background: var(--status-completed); }
.dot-failed, .dot-red { background: var(--status-failed); }
.dot-pending { background: var(--status-pending); }
.dot-cancelled, .dot-stopped { background: var(--status-cancelled); }
.dot-yellow { background: var(--status-running); }
.dot-waiting { background: var(--status-pending); }
.dot-scheduled { background: #7c3aed; }

/* --- Status Badges (inline) --- */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-done { background: #dcfce7; color: #16a34a; }
.status-started { background: #fef3c7; color: #d97706; }
.status-failed { background: #fee2e2; color: #dc2626; }
.status-reserved { background: #e0e7ff; color: #4f46e5; }
.status-scheduled { background: #ede9fe; color: #7c3aed; }

/* --- Card --- */
.card-rs {
  background: var(--bg-card);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--border-color);
}

/* --- Copy button --- */
.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.125rem;
  font-size: 0.9rem;
  vertical-align: middle;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
}

.copy-btn:hover { color: var(--text-primary); }
.copy-btn.copied { color: var(--status-completed); }

/* --- Utility --- */
.text-mono {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.max-w-page {
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-dark .navbar-inner {
    padding: 0.75rem 1rem;
  }
}
