:root {
  --bg-primary: #020617;
  --bg-secondary: rgba(15, 23, 42, 0.85);
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --danger: #ef4444;
  --warning: #facc15;
  --success: #22c55e;
  --text-muted: #94a3b8;
  --text-default: #e8edff;
  --text-bright: #f1f5f9;
}

body {
  background: radial-gradient(120% 120% at 10% 10%, rgba(56, 189, 248, 0.18), transparent 45%),
              radial-gradient(120% 120% at 90% 15%, rgba(14, 165, 233, 0.12), transparent 40%),
              var(--bg-primary);
  color: var(--text-default);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%; /* iOS Safari zoom fix */
}

main {
  flex: 1;
}

.bg-glass {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.42));
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  position: relative;
}

/* Higher opacity for better readability in content-heavy pages */
.bg-glass-solid {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.85));
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(148, 163, 184, 0.25);
  position: relative;
}
.bg-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 40%);
  border-radius: inherit;
  pointer-events: none;
}

.navbar-brand,
.nav-link {
  color: #e2e8f0 !important;
}

.nav-link {
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link:focus::after,
.nav-link.active::after {
  width: 100%;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), rgba(59, 130, 246, 0.9));
  color: #0f172a;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Compact logo image for navbar */
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  display: inline-block;
}
.brand-logo.brand-logo-lg { width: 60px; height: 60px; border-radius: 14px; }

.background-radial {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 60% at 50% 0%, rgba(56, 189, 248, 0.2), transparent 70%);
  opacity: 0.7;
}

/* Liquid glass blobs (iOS-style) */
.liquid-container {
  position: absolute;
  inset: -10% -10% -10% -10%;
  pointer-events: none;
  filter: blur(30px) saturate(120%);
  z-index: 0;
}
.liquid-container .blob {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(56, 189, 248, 0.35), rgba(30, 64, 175, 0.25) 45%, transparent 70%);
  mix-blend-mode: screen;
  animation: float-xy 22s ease-in-out infinite;
}
.liquid-container .blob.b2 {
  width: 540px; height: 540px; left: 65%; top: 15%;
  background: radial-gradient(circle at 60% 40%, rgba(14, 165, 233, 0.32), rgba(99, 102, 241, 0.22) 50%, transparent 70%);
  animation-duration: 28s; animation-delay: -6s;
}
.liquid-container .blob.b3 {
  width: 360px; height: 360px; left: 20%; top: 65%;
  background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.28), rgba(45, 212, 191, 0.18) 55%, transparent 70%);
  animation-duration: 26s; animation-delay: -11s;
}
@keyframes float-xy {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  25% { transform: translate3d(-4%, 6%, 0) scale(1.05); }
  50% { transform: translate3d(4%, -3%, 0) scale(0.97); }
  75% { transform: translate3d(-2%, -6%, 0) scale(1.03); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.card-surface {
  background: linear-gradient(160deg, rgba(9, 14, 23, 0.65), rgba(30, 64, 175, 0.28));
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 20px 45px -25px rgba(56, 189, 248, 0.45);
  position: relative;
}
.card-surface::after {
  content: "";
  position: absolute;
  top: -2px; left: -2px; right: -2px; height: 50%;
  background: radial-gradient(100% 60% at 0% 0%, rgba(255,255,255,0.18), transparent 60%),
              radial-gradient(100% 60% at 100% 0%, rgba(255,255,255,0.08), transparent 60%);
  border-top-left-radius: 1.25rem; border-top-right-radius: 1.25rem;
  pointer-events: none;
}

.card-outline {
  background: rgba(11, 18, 31, 0.58);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.badge-soft {
  background: rgba(56, 189, 248, 0.22);
  color: var(--text-default);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hero-title {
  font-size: clamp(2.8rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.1;
}

.hero-eyebrow {
  letter-spacing: 0.32em;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-actions .btn {
  min-width: 220px;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
}

.btn.loading {
  position: relative;
  color: transparent !important;
}

.btn.loading::after {
  content: 'Processing…';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #0f172a;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(14, 165, 233, 0.9));
  border: none;
  box-shadow: 0 1rem 2.5rem -1.5rem rgba(56, 189, 248, 0.9);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(14, 165, 233, 1));
}

.btn-outline-light {
  border-color: rgba(226, 232, 240, 0.35);
  color: #e2e8f0;
}

.metric-card {
  padding: 1.5rem;
  border-radius: 1rem;
  background: rgba(12, 20, 35, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
  word-break: break-word;
}

.metric-card h3 {
  font-size: 2rem;
  font-weight: 700;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-all;
  line-height: 1.2;
  margin: 0.5rem 0;
}

.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.25rem;
}

.step-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}

.step-number {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.security-callout {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
}

.table-dark {
  color: #f8fafc;
  --bs-table-bg: rgba(15, 23, 42, 0.6);
  --bs-table-striped-bg: rgba(30, 41, 59, 0.75);
  --bs-table-striped-color: #f8fafc;
}

.table th {
  border-bottom: 2px solid rgba(148, 163, 184, 0.2) !important;
}

.table td {
  border-top: 1px solid rgba(148, 163, 184, 0.08) !important;
}

.flag-red {
  color: var(--danger);
  font-weight: 600;
}

.flag-yellow {
  color: var(--warning);
  font-weight: 600;
}

.flag-green {
  color: var(--success);
  font-weight: 600;
}

.status-chip {
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.28);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

.status-chip.red i { background: var(--danger); }
.status-chip.yellow i { background: var(--warning); }
.status-chip.green i { background: var(--success); }

.dashboard-summary {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-summary .card-outline {
  padding: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dashboard-summary strong {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-default);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

form .form-control {
  background: rgba(12, 18, 32, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-default);
}

form .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(56, 189, 248, 0.15);
}

footer {
  background: rgba(2, 6, 23, 0.85);
}

.text-muted,
.text-muted a {
  color: var(--text-muted) !important;
}

.card-outline p,
.card-outline li,
.card-surface p,
.card-surface li {
  color: var(--text-default);
  line-height: 1.55;
}

.step-item p,
.card-outline ul li {
  font-size: 0.98rem;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Header Navigation */
  header nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem !important;
  }
  
  header .nav-link {
    padding: 0.5rem 0;
    font-size: 0.9rem;
  }
  
  .brand-badge {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  /* Hero Section */
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .hero-actions .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Cards and Metrics */
  .metric-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .metric-card h3 {
    font-size: 1.5rem;
  }
  
  .dashboard-summary {
    grid-template-columns: 1fr;
  }
  
  /* Tables - Make scrollable */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    font-size: 0.85rem;
  }
  
  /* Forms */
  .form-control, .form-select {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Footer */
  footer .d-flex {
    flex-direction: column;
    text-align: center;
  }
  
  footer small {
    margin-bottom: 0.5rem;
  }
  
  /* Liquid Blobs - Reduce for performance */
  .liquid-container {
    display: none;
  }
  
  /* Padding adjustments */
  main {
    padding: 2rem 0 !important;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  .card-surface, .card-outline {
    padding: 1.5rem 1rem;
  }
}

/* Small mobile devices */
@media (max-width: 576px) {
  .hero-title {
    font-size: 1.75rem;
  }
  
  .lead {
    font-size: 1rem;
  }
  
  .metric-card h3 {
    font-size: 1.25rem;
    word-break: break-all;
  }
  
  /* Stack navigation items */
  header .container {
    padding: 1rem;
  }
  
  header nav {
    width: 100%;
  }
  
  /* Adjust card spacing */
  .col-md-3, .col-md-4, .col-md-6 {
    margin-bottom: 1rem;
  }
  
  /* Smaller text for mobile */
  body {
    font-size: 0.9rem;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }
}

/* Compliance Pages - Better Readability */
.card.bg-glass-solid p,
.card.bg-glass-solid li {
  color: #cbd5e1;
  line-height: 1.7;
}

.card.bg-glass-solid strong {
  color: #f1f5f9;
}

.card.bg-glass-solid h2,
.card.bg-glass-solid h3,
.card.bg-glass-solid h4,
.card.bg-glass-solid h5 {
  color: #f8fafc !important;
}

/* Dark cards with better contrast */
.card.bg-dark-solid {
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.card.bg-dark-solid p,
.card.bg-dark-solid li {
  color: #e2e8f0;
}

/* Table improvements */
.table-dark {
  background: rgba(15, 23, 42, 0.95);
}

.table-dark td,
.table-dark th {
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.2);
}

/* Alert improvements */
.alert.bg-glass {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
}

.alert.bg-glass h6 {
  color: #f1f5f9;
}
