/* Structura — Organisation Structure Review Platform
   Arsela / Corestria brand system */

:root {
  --structura-navy: #0f2c52;
  --structura-navy-dark: #0a1f3d;
  --structura-blue: #1e5b9a;
  --structura-teal: #2db8a8;
  --structura-teal-light: #5fd4c5;
  --structura-bg: #f5f7fa;
  --structura-card: #ffffff;
  --structura-text: #1e293b;
  --structura-text-secondary: #64748b;
  --structura-success: #10b981;
  --structura-warning: #f59e0b;
  --structura-danger: #ef4444;
}

* { -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--structura-bg);
  color: var(--structura-text);
}

/* Gradient backgrounds */
.bg-gradient-structura {
  background: linear-gradient(135deg, #0f2c52 0%, #1e5b9a 50%, #2db8a8 100%);
}

.bg-gradient-structura-soft {
  background: linear-gradient(135deg, #1e5b9a 0%, #2db8a8 100%);
}

.bg-gradient-structura-button {
  background: linear-gradient(135deg, #0f2c52 0%, #2db8a8 100%);
  transition: all 0.2s ease;
}

.bg-gradient-structura-button:hover {
  background: linear-gradient(135deg, #0a1f3d 0%, #1ea193 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 44, 82, 0.25);
}

.bg-gradient-welcome {
  background: linear-gradient(120deg, #0f2c52 0%, #1e5b9a 60%, #2773a8 100%);
}

/* Sidebar */
.sidebar {
  background: var(--structura-navy);
  color: #e2e8f0;
}

.sidebar-item {
  color: #cbd5e1;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.sidebar-item.active {
  background: rgba(45, 184, 168, 0.12);
  border-left-color: var(--structura-teal);
  color: #ffffff;
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--structura-card);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(15, 44, 82, 0.05), 0 1px 2px rgba(15, 44, 82, 0.03);
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.card-hover {
  transition: all 0.2s ease;
}

.card-hover:hover {
  box-shadow: 0 4px 12px rgba(15, 44, 82, 0.08);
  transform: translateY(-1px);
}

/* KPI cards */
.kpi-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--structura-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--structura-navy);
  margin-top: 0.25rem;
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.pill-success { background: #d1fae5; color: #047857; }
.pill-warning { background: #fef3c7; color: #b45309; }
.pill-danger { background: #fee2e2; color: #b91c1c; }
.pill-info { background: #dbeafe; color: #1e40af; }
.pill-neutral { background: #f1f5f9; color: #475569; }
.pill-teal { background: #ccf7f0; color: #0d7f72; }

/* Severity pills */
.severity-low { background: #dbeafe; color: #1e40af; }
.severity-medium { background: #fef3c7; color: #b45309; }
.severity-high { background: #fed7aa; color: #c2410c; }
.severity-critical { background: #fee2e2; color: #b91c1c; }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  background: #f8fafc;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--structura-text-secondary);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.data-table tbody td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tbody tr:hover {
  background: #fafbfc;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, #0f2c52 0%, #2db8a8 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0a1f3d 0%, #1ea193 100%);
  box-shadow: 0 4px 12px rgba(15, 44, 82, 0.25);
}

.btn-secondary {
  background: white;
  color: var(--structura-navy);
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  color: var(--structura-text-secondary);
}

.btn-ghost:hover {
  background: #f1f5f9;
  color: var(--structura-navy);
}

/* Inputs */
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #f8fafc;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--structura-teal);
  background: white;
  box-shadow: 0 0 0 3px rgba(45, 184, 168, 0.1);
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--structura-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

/* Logo */
.structura-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* When the Structura logo is placed on a dark/navy background, the dark-navy
   portion of the wordmark would blend in. This filter brightens dark pixels
   to near-white while keeping the lighter teal accents readable. */
.structura-logo-on-dark {
  filter: brightness(0) invert(1);
}

/* Powered By Arsela wrapper — keep image flush, no extra spacing */
.powered-by-arsela-wrap img {
  max-width: 100%;
  object-fit: contain;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.875rem 1.25rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  animation: slideIn 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Span heatmap cells */
.heatmap-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.375rem;
  color: white;
}

.heatmap-low      { background: #dbeafe; color: #1e3a8a; }
.heatmap-good     { background: #10b981; color: white; }
.heatmap-warn     { background: #f59e0b; color: white; }
.heatmap-high     { background: #ef4444; color: white; }
.heatmap-empty    { background: #f1f5f9; color: #94a3b8; }

/* Confidence bar */
.confidence-bar {
  height: 4px;
  border-radius: 9999px;
  background: #e2e8f0;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%);
}

/* Org chart node */
.org-node {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  min-width: 180px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.org-node:hover {
  border-color: var(--structura-teal);
  box-shadow: 0 4px 12px rgba(45, 184, 168, 0.15);
}

.org-node.level-0 { border-color: var(--structura-navy); background: linear-gradient(135deg, #0f2c52, #1e5b9a); color: white; }
.org-node.level-1 { border-color: #1e5b9a; background: #1e5b9a; color: white; }
.org-node.level-2 { border-color: #3b82d8; }
.org-node.level-3 { border-color: #60a5fa; }
.org-node.outlier-low { border-color: #f59e0b; border-style: dashed; }
.org-node.outlier-high { border-color: #ef4444; border-style: dashed; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 44, 82, 0.4);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}

/* Login page */
.login-bg-panel {
  background: linear-gradient(135deg, #0f2c52 0%, #1e5b9a 50%, #2db8a8 100%);
  border-radius: 0 0 0 50%;
}

/* Powered by Arsela in sidebar */
.powered-by-arsela {
  background: rgba(255,255,255,0.06);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--structura-teal);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Hidden helper */
.hidden { display: none !important; }
