/* ==========================================================================
   Kodagu Blood Donors - Design System & Modern Styling
   ========================================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;

  /* Primary Blood Reds */
  --blood-50: #fff1f2;
  --blood-100: #ffe4e6;
  --blood-200: #fecdd3;
  --blood-300: #fda4af;
  --blood-400: #fb7185;
  --blood-500: #f43f5e;
  --blood-600: #e11d48;
  --blood-700: #be123c;
  --blood-800: #9f1239;
  --blood-900: #881337;
  --blood-950: #4c0519;

  /* Primary Theme Tokens */
  --blood-primary: #dc2626;
  --blood-dark: #991b1b;
  --blood-gradient: linear-gradient(135deg, #e11d48 0%, #be123c 45%, #991b1b 100%);
  --blood-gradient-hover: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #be123c 100%);
  --blood-gradient-subtle: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);

  /* Neutrals */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 30px -10px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-blood: 0 10px 25px -5px rgba(225, 29, 72, 0.35);
}

/* Base Typography */
body {
  font-family: var(--font-main);
  color: #1e293b;
  background-color: #f8fafc;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .font-display, .display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Text & Colors */
.text-blood {
  color: var(--blood-600) !important;
}

.text-gradient-blood {
  background: var(--blood-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.bg-blood {
  background: var(--blood-gradient) !important;
  color: #ffffff !important;
}

.bg-blood-subtle {
  background-color: var(--blood-50) !important;
}

.border-blood {
  border-color: var(--blood-400) !important;
}

/* ==========================================================================
   Navigation & Topbar
   ========================================================================== */
.top-emergency-bar {
  background: linear-gradient(90deg, #881337 0%, #4c0519 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--blood-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar-brand:hover .brand-logo-icon {
  transform: scale(1.08) rotate(-4deg);
}

.navbar {
  backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  transition: all 0.3s ease;
}

.navbar-brand {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.navbar .nav-link {
  font-weight: 500;
  color: #475569;
  padding: 0.5rem 0.85rem !important;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.navbar .nav-link:hover {
  color: var(--blood-600);
  background-color: var(--blood-50);
}

.navbar .nav-link.active {
  color: var(--blood-700) !important;
  font-weight: 700;
  background-color: var(--blood-50);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: -0.01em;
}

.btn-blood {
  background: var(--blood-gradient);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.3);
}

.btn-blood:hover, .btn-blood:focus {
  background: var(--blood-gradient-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.4);
}

.btn-blood:active {
  transform: translateY(0);
}

.btn-outline-blood {
  background: transparent;
  color: var(--blood-600);
  border: 1.5px solid var(--blood-600);
}

.btn-outline-blood:hover, .btn-outline-blood:focus {
  background: var(--blood-gradient);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
}

.btn-light {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}

.btn-light:hover {
  background-color: #f1f5f9;
  transform: translateY(-1px);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  background: radial-gradient(circle at 80% 20%, rgba(244, 63, 94, 0.25) 0%, transparent 40%),
              radial-gradient(circle at 10% 80%, rgba(190, 18, 60, 0.3) 0%, transparent 50%),
              linear-gradient(135deg, #991b1b 0%, #881337 60%, #4c0519 100%);
  color: #ffffff;
  padding: 4.5rem 0 5.5rem;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 2rem 2rem;
}

/* Background floating ambient light */
.hero-section::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(251, 113, 133, 0.25) 0%, transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

.hero-search-card {
  background: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.2);
  padding: 2rem;
  color: #1e293b;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.hero-badge-tag {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   Impact Statistics Cards
   ========================================================================== */
.stat-card-modern {
  background: #ffffff;
  border-radius: 1.25rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.stat-card-modern:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

.stat-card-modern .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* ==========================================================================
   Blood Group Badges
   ========================================================================== */
.blood-badge {
  width: 58px;
  height: 58px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  color: var(--blood-700);
  border: 1.5px solid var(--blood-200);
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.08);
  transition: all 0.25s ease;
}

.blood-group-card {
  background: #ffffff;
  border-radius: 1.25rem;
  border: 1px solid #e2e8f0;
  padding: 1.25rem 1rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.blood-group-card:hover {
  transform: translateY(-4px);
  border-color: var(--blood-300);
  box-shadow: 0 12px 24px -6px rgba(225, 29, 72, 0.15);
}

.blood-group-card:hover .blood-badge {
  background: var(--blood-gradient);
  color: #ffffff;
  border-color: transparent;
  transform: scale(1.05);
}

/* ==========================================================================
   Donor Cards
   ========================================================================== */
.donor-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.donor-card:hover {
  transform: translateY(-4px);
  border-color: var(--blood-300);
  box-shadow: var(--shadow-lg);
}

/* Pulsing radar dot for available donors */
.status-dot-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  position: relative;
}

.status-dot-pulse::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: rgba(16, 185, 129, 0.4);
  animation: pulse-ring 1.8s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ==========================================================================
   Emergency Banner & Cards
   ========================================================================== */
.emergency-card-modern {
  border-radius: 1.25rem;
  background: #ffffff;
  border: 2px solid #fda4af;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  overflow: hidden;
}

.emergency-card-modern:hover {
  transform: translateY(-3px);
  border-color: var(--blood-600);
  box-shadow: 0 16px 28px -6px rgba(225, 29, 72, 0.25);
}

.emergency-beacon {
  width: 10px;
  height: 10px;
  background-color: #ef4444;
  border-radius: 50%;
  display: inline-block;
  animation: beacon-pulse 1.2s infinite ease-in-out;
}

@keyframes beacon-pulse {
  0% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   Form Controls & Modern Inputs
   ========================================================================== */
.form-control, .form-select {
  border-radius: 0.65rem;
  border: 1.5px solid #e2e8f0;
  padding: 0.65rem 0.95rem;
  font-size: 0.95rem;
  color: #1e293b;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--blood-400);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.12);
  outline: none;
}

.form-control-lg, .form-select-lg {
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
}

.form-check-input:checked {
  background-color: var(--blood-600);
  border-color: var(--blood-600);
}

.form-check-input:focus {
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.15);
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge.bg-success-subtle {
  background-color: #ecfdf5 !important;
  color: #059669 !important;
  border: 1px solid #a7f3d0;
}

.badge.bg-danger-subtle {
  background-color: #fff1f2 !important;
  color: #e11d48 !important;
  border: 1px solid #fecdd3;
}

.badge.bg-warning-subtle {
  background-color: #fffbeb !important;
  color: #d97706 !important;
  border: 1px solid #fde68a;
}

.badge.bg-primary-subtle {
  background-color: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  background-color: #0f172a !important;
  border-top: 4px solid var(--blood-600);
}

footer a.hover-white:hover {
  color: #ffffff !important;
  transform: translateX(2px);
  display: inline-block;
  transition: all 0.15s ease;
}

/* ==========================================================================
   PWA Banner
   ========================================================================== */
#pwa-install-banner {
  display: none !important;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
}

#pwa-install-banner.show-banner {
  display: flex !important;
}

/* ==========================================================================
   Micro-interactions & Utilities
   ========================================================================== */
.hover-lift {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-lift:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px -3px rgba(0, 0, 0, 0.15) !important;
}

.hover-shadow {
  transition: all 0.25s ease;
}

.hover-shadow:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px -6px rgba(0, 0, 0, 0.1) !important;
}

.card {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Glassmorphism Panel */
.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* Modal styling */
.modal-content {
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.modal-header.bg-blood {
  background: var(--blood-gradient) !important;
}

/* Form input group styling */
.input-group-text {
  border-radius: 0.65rem;
  border-color: #e2e8f0;
}

.input-group > .input-group-text:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group > .form-control:not(:first-child),
.input-group > .form-select:not(:first-child) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-section {
    padding: 2.75rem 0 3.5rem;
    border-radius: 0 0 1.25rem 1.25rem;
  }
  .hero-search-card {
    padding: 1.25rem;
  }
  .stat-number {
    font-size: 1.75rem;
  }
}
