/* Battle Bridge Portal — v2 */
/* Brand: #091026 (dark navy), #2A4B9C (blue), #152340 (secondary), #4C525B (charcoal) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #060b18;
  --bg-elevated: #0a1022;
  --bg-card: #0c1426;
  --bg-card-hover: #111c34;
  --bg-input: #0c1426;
  --border: #1a2744;
  --border-hover: #2a3d66;
  --text: #e8eaf0;
  --text-muted: #7b89a8;
  --text-dim: #4a5878;
  --accent: #2A4B9C;
  --accent-hover: #3a63c4;
  --accent-light: #4d7ae0;
  --accent-dim: rgba(42, 75, 156, 0.15);
  --accent-glow: rgba(42, 75, 156, 0.3);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --max-w: 1140px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-light); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* =============================================
   NAVIGATION (shared: homepage + dashboard)
   ============================================= */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 11, 24, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.nav-brand .icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-center a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-center a:hover { color: var(--text); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-user .role-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent-light);
  font-weight: 600;
}

.nav-user .logout-btn {
  color: var(--text-dim);
  font-size: 0.8rem;
}
.nav-user .logout-btn:hover { color: var(--danger); }

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: white;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  border-color: rgba(255,255,255,0.2);
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 0.95rem;
  border-radius: var(--radius);
}

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; color: white; }

/* =============================================
   HOMEPAGE
   ============================================= */

/* -- Hero -- */
.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(42, 75, 156, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 30% 80%, rgba(42, 75, 156, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 50% at 80% 60%, rgba(20, 40, 100, 0.06) 0%, transparent 50%);
}

/* Subtle grid overlay */
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(42, 75, 156, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 75, 156, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 0%, transparent 70%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-logo {
  width: 280px;
  margin: 0 auto 2.5rem;
  opacity: 0.92;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #ffffff 0%, #b0bec5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subhead {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* -- Section shared -- */
.section {
  padding: 6rem 2rem;
}

.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-light);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 640px;
}

/* -- What We Do cards -- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
}

.portfolio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
}

.portfolio-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.portfolio-card .card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 1.25rem;
  width: fit-content;
}

.card-badge.blue { background: rgba(42, 75, 156, 0.15); color: #5b8def; }
.card-badge.teal { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.card-badge.purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

.portfolio-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.portfolio-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  flex: 1;
}

.portfolio-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-light);
  transition: gap 0.2s;
}

.portfolio-card:hover .card-link {
  gap: 0.6rem;
}

.card-link .arrow {
  transition: transform 0.2s;
}
.portfolio-card:hover .card-link .arrow {
  transform: translateX(2px);
}

/* -- Why AI-First -- */
.why-section {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.why-section .section-desc {
  max-width: 780px;
  font-size: 1.1rem;
}

/* -- Portal Access -- */
.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
}

.portal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.portal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.portal-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.portal-card:hover::before {
  opacity: 1;
}

.portal-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.portal-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

/* -- Footer -- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-logo {
  width: 160px;
  margin: 0 auto 1.25rem;
  opacity: 0.5;
}

.footer-tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.footer-contact {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* -- Scroll animations -- */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* stagger children */
.fade-up-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-up-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

.fade-up-stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.fade-up-stagger.visible > *:nth-child(2) { transition-delay: 0.1s; }
.fade-up-stagger.visible > *:nth-child(3) { transition-delay: 0.2s; }

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
}

.login-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(42, 75, 156, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  position: relative;
}

.login-box .login-logo {
  width: 140px;
  margin: 0 auto 1.5rem;
  opacity: 0.8;
}

.login-box h2 {
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
  font-weight: 700;
  text-align: center;
}

.login-box .subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group input::placeholder {
  color: var(--text-dim);
}

.alert {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.form-actions {
  margin-top: 1rem;
}

/* =============================================
   DASHBOARD (internal pages)
   ============================================= */

.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.dashboard .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.2s;
  display: block;
  color: var(--text);
}

a.card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 1rem;
}

.card-icon.purple { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.card-icon.green { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.card-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.card-icon.orange { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.card-icon.red { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.card-icon.teal { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.83rem;
  line-height: 1.5;
}

.card .badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 3px;
  margin-top: 0.75rem;
  font-weight: 600;
}

.badge-live { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-placeholder { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* ---- EMBED ---- */
.embed-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
}

.embed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.embed-toolbar h2 {
  font-size: 1rem;
  font-weight: 600;
}

.embed-toolbar a {
  font-size: 0.85rem;
}

.embed-frame {
  flex: 1;
  border: none;
  width: 100%;
  background: var(--bg);
}

/* ---- TABLES ---- */
.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

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

table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--bg-card-hover); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
}
.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--danger); }

/* ---- ADMIN ---- */
.admin-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ---- SYSTEMS ---- */
.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.system-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.system-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.system-card .detail {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.8rem;
}

.system-card .detail .label { color: var(--text-muted); }
.system-card .detail .value { color: var(--text); font-weight: 500; }

/* ---- CLIENT ---- */
.client-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.report-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.report-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-item a { font-weight: 500; }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
}

.modal h3 { margin-bottom: 1rem; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
  .portfolio-grid { grid-template-columns: 1fr; }
  .portal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .nav-center { display: none; }
  .hero h1 { font-size: 2.2rem; }
  .hero .subhead { font-size: 1rem; }
  .hero-logo { width: 200px; }
  .section { padding: 4rem 1.25rem; }
  .section-title { font-size: 1.6rem; }
  .dashboard { padding: 1.5rem 1rem; }
  .card-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .embed-toolbar { padding: 0.7rem 1rem; }
  .system-grid { grid-template-columns: 1fr; }
  .portal-card { padding: 2rem; }
}

@media (max-width: 480px) {
  .hero { padding: 3rem 1.25rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero-ctas { flex-direction: column; align-items: center; }
  .hero-ctas .btn { width: 100%; max-width: 280px; }
  .nav-right .btn { display: none; }
}

/* Mobile nav toggle (hamburger on small screens) */
@media (max-width: 768px) {
  .nav-right .nav-link-text { display: none; }
}
