/* ==========================================================================
   Bondhu Seba Digital Healthcare Pvt. Ltd.
   Global Stylesheet
   Supplements Tailwind CSS CDN
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Google Fonts Import
   -------------------------------------------------------------------------- */
@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&display=swap');


/* --------------------------------------------------------------------------
   2. CSS Custom Properties (Brand Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Brand Colors */
  --color-primary-green:  #10B981;
  --color-dark-green:     #047857;
  --color-primary-blue:   #0284C7;
  --color-dark-navy:      #0F172A;
  --color-emergency-red:  #EF4444;

  /* Neutral Shades */
  --color-slate-50:   #F8FAFC;
  --color-slate-100:  #F1F5F9;
  --color-slate-600:  #475569;
  --color-slate-900:  #0F172A;

  /* Spacing & Shape */
  --radius-card: 1rem;       /* 16px */
  --radius-btn:  0.5rem;     /* 8px  */

  /* Transitions */
  --transition-base: 200ms ease;
  --transition-card: 300ms ease;
}


/* --------------------------------------------------------------------------
   3. Base / Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Hind Siliguri', 'Inter', sans-serif;
  color: var(--color-slate-900);
  background-color: #ffffff;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Bengali text nodes inherit Hind Siliguri naturally via body stack.
   Add .bn class explicitly when forcing Bengali font on mixed content. */
.bn {
  font-family: 'Hind Siliguri', sans-serif;
}

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

a {
  text-decoration: none;
  color: inherit;
}


/* --------------------------------------------------------------------------
   4. Custom Scrollbar (Webkit)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-slate-100);
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-primary-green);
  border-radius: 4px;
  border: 2px solid var(--color-slate-100);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-dark-green);
}


/* --------------------------------------------------------------------------
   5. Button Components
   -------------------------------------------------------------------------- */

/* -- 5a. Primary Button -- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #059669;        /* emerald-600 */
  color: #ffffff;
  padding: 0.75rem 1.5rem;          /* py-3 px-6 */
  border-radius: var(--radius-btn);
  font-family: 'Hind Siliguri', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary:hover {
  background-color: var(--color-dark-green);  /* #047857 */
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary:focus-visible {
  outline: 3px solid var(--color-primary-green);
  outline-offset: 2px;
}


/* -- 5b. Secondary Button -- */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: transparent;
  color: #059669;                   /* emerald-600 */
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-btn);
  font-family: 'Hind Siliguri', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  border: 2px solid #059669;
  cursor: pointer;
  transition: background-color var(--transition-base),
              color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
}

.btn-secondary:hover {
  background-color: #ECFDF5;        /* emerald-50 */
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary:focus-visible {
  outline: 3px solid var(--color-primary-green);
  outline-offset: 2px;
}


/* -- 5c. Danger / Emergency Button -- */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #DC2626;        /* red-600 */
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-btn);
  font-family: 'Hind Siliguri', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  animation: emergencyPulse 2.4s ease-in-out infinite;
  transition: background-color var(--transition-base),
              transform var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
}

.btn-danger:hover {
  background-color: #B91C1C;        /* red-700 */
  animation-play-state: paused;
  transform: translateY(-1px);
}

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

.btn-danger:focus-visible {
  outline: 3px solid var(--color-emergency-red);
  outline-offset: 2px;
}

/* Emergency pulse glow keyframe */
@keyframes emergencyPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
}


/* --------------------------------------------------------------------------
   6. Typography Helpers
   -------------------------------------------------------------------------- */

.section-title {
  font-size: 1.875rem;              /* text-3xl */
  font-weight: 700;
  color: var(--color-slate-900);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 1rem;                  /* text-base */
  color: var(--color-slate-600);
  line-height: 1.65;
  font-weight: 400;
}


/* --------------------------------------------------------------------------
   7. Card Component
   -------------------------------------------------------------------------- */
.card {
  background-color: #ffffff;
  border-radius: 1rem;              /* rounded-2xl */
  border: 1px solid #F1F5F9;       /* border-slate-100 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
              0 1px 2px rgba(0, 0, 0, 0.04);   /* shadow-sm */
  transition: box-shadow var(--transition-card),
              transform var(--transition-card);
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10),
              0 2px 6px rgba(0, 0, 0, 0.06);   /* shadow-md */
  transform: translateY(-4px);
}


/* --------------------------------------------------------------------------
   8. Navigation
   -------------------------------------------------------------------------- */

/* Active nav link state */
.nav-link-active {
  color: #059669 !important;        /* text-emerald-600 */
  font-weight: 600;
  border-bottom: 2px solid #10B981; /* border-emerald-500 */
  padding-bottom: 2px;
}

/* Sticky header scroll state - applied by nav.js */
#main-header {
  transition: box-shadow 200ms ease, background-color 200ms ease;
}

#main-header.is-scrolled {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10),
              0 2px 4px rgba(0, 0, 0, 0.06);   /* shadow-md equivalent */
  background-color: rgba(255, 255, 255, 0.98);
}

/* Mobile menu drawer */
#mobile-menu {
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

#mobile-menu.open {
  transform: translateX(0);
}

/* Menu overlay */
#menu-overlay {
  transition: opacity 300ms ease;
}


/* --------------------------------------------------------------------------
   9. Focus / Accessibility
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--color-primary-green);
  outline-offset: 2px;
}

/* Skip to main content link (placed first in body) */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--color-dark-green);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 600;
  z-index: 9999;
  transition: top 200ms;
}

.skip-link:focus {
  top: 0;
}


/* --------------------------------------------------------------------------
   10. Utility Overrides
   -------------------------------------------------------------------------- */

/* Prevent body scroll when mobile menu is open (applied via JS) */
body.overflow-hidden {
  overflow: hidden;
}

/* Smooth image loading placeholder */
.img-placeholder {
  background-color: var(--color-slate-100);
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0%   { opacity: 1; }
  50%  { opacity: 0.5; }
  100% { opacity: 1; }
}


/* --------------------------------------------------------------------------
   11. Responsive Breakpoint Helpers
   Mobile-first: 375px | Tablet: 768px | Desktop: 1280px
   -------------------------------------------------------------------------- */

/* Full-width buttons on small screens */
@media (max-width: 479px) {
  .btn-primary,
  .btn-secondary,
  .btn-danger {
    width: 100%;
    justify-content: center;
  }
}

/* Section title scales up on larger screens */
@media (min-width: 768px) {
  .section-title {
    font-size: 2.25rem;             /* text-4xl */
  }
}

@media (min-width: 1280px) {
  .section-title {
    font-size: 2.5rem;
  }
}


/* --------------------------------------------------------------------------
   12. Mobile UX & Floating Action Dock
   -------------------------------------------------------------------------- */

/* Remove mobile tap grey overlay */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Touch active feedback */
button:active,
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: scale(0.98);
}

/* Fixed Mobile Bottom Emergency Dock */
.mobile-action-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #E2E8F0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: 0.5rem 1rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .mobile-action-dock {
    display: none !important;
  }
}

/* Floating Back to Top Button */
#backToTopBtn {
  position: fixed;
  bottom: 5.5rem;
  right: 1.25rem;
  z-index: 40;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background-color: #0F172A;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 250ms ease, transform 250ms ease, visibility 250ms ease, background-color 200ms ease;
}

@media (min-width: 768px) {
  #backToTopBtn {
    bottom: 2rem;
    right: 2rem;
  }
}

#backToTopBtn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#backToTopBtn:hover {
  background-color: #047857;
}



/* --------------------------------------------------------------------------
   11. Mobile Responsive Stacked Data Cards (table.responsive-table)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  table.responsive-table thead {
    display: none;
  }
  table.responsive-table,
  table.responsive-table tbody,
  table.responsive-table tr,
  table.responsive-table td {
    display: block;
    width: 100%;
  }
  table.responsive-table tbody tr {
    margin-bottom: 0.75rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.65rem 0.9rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  }
  table.responsive-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid #f1f5f9;
    text-align: right;
  }
  table.responsive-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0.25rem;
  }
  table.responsive-table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #64748b;
    text-align: left;
    flex-shrink: 0;
    font-size: 0.7rem;
    max-width: 45%;
  }
}
