/* ==========================================================================
   People's Political History Database (PHDA) — Master Design System
   Aesthetic: Digital Evidence & Human Rights Archival Editorial
   ========================================================================== */

/* --- Google Web Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+Bengali:wght@400;500;600;700&display=swap');

:root {
  /* Brand National Tones */
  --phda-emerald: #006a4e;
  --phda-emerald-dark: #004d38;
  --phda-emerald-light: #059669;
  --phda-emerald-subtle: #ecfdf5;
  --phda-crimson: #f42a41;
  --phda-crimson-subtle: #fef2f2;
  --phda-amber: #d97706;
  --phda-amber-subtle: #fffbeb;
  --phda-navy: #0f172a;
  --phda-slate: #334155;
  --phda-muted: #64748b;

  /* Theme Surfaces (Light Mode Default) */
  --phda-bg: #f8fafc;
  --phda-card-bg: #ffffff;
  --phda-card-border: #e2e8f0;
  --phda-well-bg: #f1f5f9;
  --phda-text-main: #0f172a;
  --phda-text-secondary: #334155;
  --phda-text-muted: #64748b;
  --phda-header-glass: rgba(255, 255, 255, 0.88);
  --phda-header-border: rgba(226, 232, 240, 0.8);
  --phda-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --phda-card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Status Colors */
  --status-verified-bg: #d1fae5;
  --status-verified-text: #065f46;
  --status-verified-border: #a7f3d0;

  --status-pending-bg: #fef3c7;
  --status-pending-text: #92400e;
  --status-pending-border: #fde68a;

  --status-unverified-bg: #f1f5f9;
  --status-unverified-text: #475569;
  --status-unverified-border: #cbd5e1;

  --status-disputed-bg: #fee2e2;
  --status-disputed-text: #991b1b;
  --status-disputed-border: #fecaca;

  /* 3-Tier Triangulation Badges */
  --tier-allegation-bg: #fef3c7;
  --tier-allegation-text: #92400e;
  --tier-eyewitness-bg: #e0f2fe;
  --tier-eyewitness-text: #0369a1;
  --tier-verified-bg: #d1fae5;
  --tier-verified-text: #065f46;
}

[data-bs-theme="dark"] {
  --phda-bg: #090e17;
  --phda-card-bg: #111827;
  --phda-card-border: #1f2937;
  --phda-well-bg: #1a2234;
  --phda-text-main: #f8fafc;
  --phda-text-secondary: #cbd5e1;
  --phda-text-muted: #94a3b8;
  --phda-header-glass: rgba(17, 24, 39, 0.88);
  --phda-header-border: rgba(31, 41, 55, 0.8);
  --phda-card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --phda-card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.45);

  --phda-emerald: #10b981;
  --phda-emerald-subtle: rgba(16, 185, 129, 0.12);
  --phda-crimson: #fb7185;
  --phda-crimson-subtle: rgba(244, 42, 65, 0.12);

  --status-verified-bg: rgba(16, 185, 129, 0.15);
  --status-verified-text: #34d399;
  --status-verified-border: rgba(16, 185, 129, 0.3);

  --status-pending-bg: rgba(245, 158, 11, 0.15);
  --status-pending-text: #fbbf24;
  --status-pending-border: rgba(245, 158, 11, 0.3);

  --status-unverified-bg: rgba(148, 163, 184, 0.15);
  --status-unverified-text: #cbd5e1;
  --status-unverified-border: rgba(148, 163, 184, 0.3);

  --status-disputed-bg: rgba(239, 68, 68, 0.15);
  --status-disputed-text: #f87171;
  --status-disputed-border: rgba(239, 68, 68, 0.3);

  --tier-allegation-bg: rgba(245, 158, 11, 0.15);
  --tier-allegation-text: #fbbf24;
  --tier-eyewitness-bg: rgba(56, 189, 248, 0.15);
  --tier-eyewitness-text: #38bdf8;
  --tier-verified-bg: rgba(16, 185, 129, 0.15);
  --tier-verified-text: #34d399;
}

/* --- Global Base Typography & Smooth Scroll --- */
html, body {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: 'Hind Siliguri', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--phda-bg);
  color: var(--phda-text-secondary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  max-width: 100vw;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--phda-text-main);
  font-weight: 700;
  letter-spacing: -0.015em;
  font-family: 'Hind Siliguri', 'Noto Sans Bengali', 'Inter', sans-serif;
}

a {
  color: var(--phda-emerald);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--phda-emerald-dark);
}

/* Numbers in Latin/Tabular style when desirable */
.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-family: 'Inter', sans-serif;
}

/* --- Sticky Glassmorphism Navbar --- */
.phda-navbar {
  background-color: var(--phda-header-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--phda-header-border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1040;
  max-width: 100vw;
  box-sizing: border-box;
}

.phda-navbar .dropdown-menu {
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--phda-card-border);
  background-color: var(--phda-card-bg);
  padding: 8px;
}

.phda-navbar .dropdown-item {
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--phda-text-secondary);
}

.phda-navbar .dropdown-item:hover {
  background-color: var(--phda-emerald-subtle);
  color: var(--phda-emerald);
}

.media-fallback-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #004d38 0%, #006a4e 50%, #1e293b 100%);
  color: #ffffff;
  padding: 16px;
  text-align: center;
}

.phda-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  color: var(--phda-text-main);
}

.phda-brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #006a4e 0%, #004d38 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(0, 106, 78, 0.25);
  position: relative;
  overflow: hidden;
}

.phda-brand-logo::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--phda-crimson);
}

.phda-brand-text {
  display: flex;
  flex-direction: column;
}

.phda-brand-title {
  font-size: 1.125rem;
  line-height: 1.2;
  color: var(--phda-text-main);
  font-weight: 800;
}

.phda-brand-sub {
  font-size: 0.72rem;
  color: var(--phda-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.phda-nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--phda-text-secondary) !important;
  padding: 8px 12px !important;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.phda-nav-link:hover {
  color: var(--phda-emerald) !important;
  background-color: var(--phda-emerald-subtle);
}

.phda-nav-link.active {
  color: var(--phda-emerald) !important;
  background-color: var(--phda-emerald-subtle);
  font-weight: 700;
}

/* Optimize navbar layout for laptop screens (1140px) to prevent horizontal push */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .phda-brand-sub {
    display: none !important;
  }
  .phda-brand-logo {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.1rem !important;
  }
  .phda-brand-title {
    font-size: 1rem !important;
  }
  .phda-nav-link {
    font-size: 0.8rem !important;
    padding: 6px 7px !important;
    gap: 4px !important;
  }
  .phda-navbar .container-fluid {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}

/* Secondary header pills */
.nav-pills-custom .nav-link {
  color: var(--phda-text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 9999px;
  padding: 6px 14px;
  transition: all 0.2s ease;
}

.nav-pills-custom .nav-link.active {
  background-color: var(--phda-emerald);
  color: #ffffff;
}

/* --- Hero Banner Section --- */
.phda-hero {
  position: relative;
  background-color: #0b1120;
  color: #ffffff;
  padding: 80px 0 60px;
  overflow: hidden;
}

.phda-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(0, 106, 78, 0.45) 0%, transparent 60%),
              radial-gradient(circle at 80% 70%, rgba(244, 42, 65, 0.25) 0%, transparent 50%),
              linear-gradient(180deg, rgba(11, 17, 32, 0.75) 0%, rgba(11, 17, 32, 0.95) 100%);
  z-index: 1;
}

.phda-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  filter: grayscale(40%) contrast(110%);
}

.phda-hero-content {
  position: relative;
  z-index: 2;
}

.phda-hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
}

.phda-hero-desc {
  font-size: 1.1rem;
  color: #cbd5e1;
  max-width: 720px;
}

/* --- Archival Cards & Elevation --- */
.phda-card {
  background-color: var(--phda-card-bg);
  border: 1px solid var(--phda-card-border);
  border-radius: 14px;
  box-shadow: var(--phda-card-shadow);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  overflow: hidden;
}

.phda-card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--phda-card-shadow-hover);
  border-color: rgba(0, 106, 78, 0.3);
}

.phda-card-header {
  padding: 1rem 1.25rem;
  background-color: transparent;
  border-bottom: 1px solid var(--phda-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.phda-card-body {
  padding: 1.25rem;
}

.phda-well {
  background-color: var(--phda-well-bg);
  border: 1px solid var(--phda-card-border);
  border-radius: 10px;
  padding: 1rem;
}

/* --- Verification Badges --- */
.badge-verification {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge-verified {
  background-color: var(--status-verified-bg);
  color: var(--status-verified-text);
  border-color: var(--status-verified-border);
}

.badge-pending {
  background-color: var(--status-pending-bg);
  color: var(--status-pending-text);
  border-color: var(--status-pending-border);
  animation: pulse-amber 2.5s infinite;
}

.badge-unverified {
  background-color: var(--status-unverified-bg);
  color: var(--status-unverified-text);
  border-color: var(--status-unverified-border);
}

.badge-disputed {
  background-color: var(--status-disputed-bg);
  color: var(--status-disputed-text);
  border-color: var(--status-disputed-border);
}

@keyframes pulse-amber {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.75;
  }
}

/* --- Incident 3-Tier Triangulation Badges --- */
.badge-evidence {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-allegation {
  background-color: var(--tier-allegation-bg);
  color: var(--tier-allegation-text);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.badge-eyewitness {
  background-color: var(--tier-eyewitness-bg);
  color: var(--tier-eyewitness-text);
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-verified-fact {
  background-color: var(--tier-verified-bg);
  color: var(--tier-verified-text);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* --- Unique Identifier Badge --- */
.phda-id-pill {
  font-family: 'Inter', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background-color: var(--phda-emerald-subtle);
  color: var(--phda-emerald);
  border: 1px solid rgba(0, 106, 78, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --- Person Avatar / Portrait Styling --- */
.phda-avatar {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--phda-card-border);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.phda-avatar-lg {
  width: 140px;
  height: 140px;
  border-radius: 16px;
  object-fit: cover;
  border: 3px solid #ffffff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.phda-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--phda-well-bg);
  color: var(--phda-text-muted);
  font-size: 2.5rem;
}

/* --- Timeline Architecture --- */
.phda-timeline {
  position: relative;
  padding-left: 32px;
}

.phda-timeline::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 12px;
  width: 2px;
  background: linear-gradient(180deg, var(--phda-emerald) 0%, rgba(0, 106, 78, 0.2) 100%);
}

.phda-timeline-item {
  position: relative;
  margin-bottom: 28px;
}

.phda-timeline-item:last-child {
  margin-bottom: 0;
}

.phda-timeline-dot {
  position: absolute;
  left: -32px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--phda-card-bg);
  border: 3px solid var(--phda-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px var(--phda-emerald-subtle);
  z-index: 2;
}

.phda-timeline-dot-crimson {
  border-color: var(--phda-crimson);
  box-shadow: 0 0 0 4px var(--phda-crimson-subtle);
}

.phda-timeline-dot-amber {
  border-color: var(--phda-amber);
  box-shadow: 0 0 0 4px var(--phda-amber-subtle);
}

/* --- Search Bar & Inputs --- */
.phda-search-box {
  position: relative;
  background-color: var(--phda-card-bg);
  border: 1px solid var(--phda-card-border);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
}

.phda-search-input {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 1rem;
  color: var(--phda-text-main);
  width: 100%;
}

.phda-search-input:focus {
  outline: none;
}

/* Custom Buttons */
.btn-emerald {
  background-color: var(--phda-emerald);
  color: #ffffff;
  border: 1px solid transparent;
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 18px;
  transition: all 0.2s ease;
}

.btn-emerald:hover {
  background-color: var(--phda-emerald-dark);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 106, 78, 0.25);
}

.btn-crimson {
  background-color: var(--phda-crimson);
  color: #ffffff;
  border: 1px solid transparent;
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 18px;
  transition: all 0.2s ease;
}

.btn-crimson:hover {
  background-color: #d81d33;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(244, 42, 65, 0.25);
}

.btn-soft {
  background-color: var(--phda-well-bg);
  color: var(--phda-text-secondary);
  border: 1px solid var(--phda-card-border);
  font-weight: 600;
  border-radius: 10px;
  padding: 8px 16px;
  transition: all 0.2s ease;
}

.btn-soft:hover {
  background-color: var(--phda-card-border);
  color: var(--phda-text-main);
}

/* --- Stat Counter Card --- */
.stat-card {
  padding: 1.25rem;
  border-radius: 14px;
  background-color: var(--phda-card-bg);
  border: 1px solid var(--phda-card-border);
  box-shadow: var(--phda-card-shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--phda-text-main);
  font-family: 'Inter', sans-serif;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--phda-text-muted);
  font-weight: 600;
  margin-top: 4px;
}

/* --- Document Lock Overlay for Public Users --- */
.restricted-overlay {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

.restricted-lock-badge {
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* --- Photo Credit Tag --- */
.photo-credit-tag {
  font-size: 0.72rem;
  color: var(--phda-text-muted);
  font-style: italic;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- Toast Notifications (Top Right) --- */
.phda-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.phda-toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background-color: var(--phda-card-bg);
  border: 1px solid var(--phda-card-border);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slide-in-toast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-in-toast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* --- Shimmer Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--phda-well-bg) 25%, var(--phda-card-border) 50%, var(--phda-well-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* --- Sticky Bottom Mobile Bar for Dossier --- */
@media (max-width: 768px) {
  .mobile-sticky-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--phda-header-glass);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--phda-header-border);
    padding: 10px 16px;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  }
  body {
    padding-bottom: 60px;
  }
}

/* --- Print View & Dossier Layout --- */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

  .phda-navbar,
  .phda-footer,
  .no-print,
  .btn,
  .phda-toast-container,
  .theme-toggle-btn {
    display: none !important;
  }

  .phda-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 15px;
  }

  .print-header {
    display: block !important;
    border-bottom: 2px solid #000;
    padding-bottom: 12px;
    margin-bottom: 20px;
  }

  a[href]::after {
    content: none !important;
  }
}

.print-header {
  display: none;
}
