/* ==========================================================================
   Medex BD Clone - Modern Healthcare & Medicine Directory Stylesheet
   ========================================================================== */

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

:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #ccfbf1;
  --secondary: #0284c7;
  --secondary-hover: #0369a1;
  --dark: #0f172a;
  --slate-800: #1e293b;
  --slate-600: #475569;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --font-main: 'Noto Serif Bengali', serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.03);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

a:hover {
  color: var(--primary-hover);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
.navbar {
  background-color: var(--white);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.navbar .container,
.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 68px;
  position: relative;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  flex-shrink: 0;
}

.navbar-brand span {
  color: var(--secondary);
}

/* Desktop Navbar Navigation */
.navbar-collapse {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
  margin-left: 20px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 18px;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: var(--slate-600);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--slate-100);
}

/* Navbar Dropdown Submenus (Desktop) */
.navbar-nav .nav-item {
  position: relative;
}

.nav-item-row {
  display: flex;
  align-items: center;
}

.dropdown-arrow {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
  margin-left: 2px;
  opacity: 0.7;
}

.navbar-nav .nav-item.dropdown:hover .dropdown-arrow,
.navbar-nav .nav-item.dropdown.show .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 240px;
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  padding: 8px 6px;
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1000;
}

.navbar-nav .nav-item.dropdown:hover .dropdown-menu,
.navbar-nav .nav-item.dropdown.show .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Wide 2-Column Mega Dropdown for Multi-Item Pillars (Desktop) */
@media (min-width: 992px) {
  .dropdown-menu.dropdown-menu-wide {
    min-width: 530px;
    padding: 10px 12px;
  }
  .navbar-nav .nav-item.dropdown:hover .dropdown-menu.dropdown-menu-wide,
  .navbar-nav .nav-item.dropdown.show .dropdown-menu.dropdown-menu-wide {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 8px;
  }
  .dropdown-menu.dropdown-menu-end {
    left: auto;
    right: 0;
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: var(--slate-700);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.dropdown-item:hover {
  background-color: var(--slate-100);
  color: var(--primary);
  border-left-color: var(--primary);
  padding-left: 16px;
}

.dropdown-item-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dropdown-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-icon {
  font-size: 1rem;
  margin-right: 4px;
  vertical-align: middle;
}

.btn-admin {
  background-color: var(--primary);
  color: var(--white) !important;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.btn-admin:hover {
  background-color: var(--primary-hover);
}

/* Mobile-only elements (hidden on desktop) */
.navbar-mobile-actions,
.mobile-drawer-header,
.mobile-drawer-footer,
.mobile-submenu-toggle,
.navbar-backdrop {
  display: none;
}

.navbar-drawer-body {
  display: contents;
}

/* Hero Section & Search */
.hero-section {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 50%, #0284c7 100%);
  color: var(--white);
  padding: 60px 0 80px 0;
  text-align: center;
  position: relative;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.15rem;
  opacity: 0.95;
  max-width: 650px;
  margin: 0 auto 35px auto;
}

/* Search Box Container */
.search-wrapper {
  max-width: 780px;
  margin: 0 auto;
  position: relative;
}

.search-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.search-tab-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.search-tab-btn.active, .search-tab-btn:hover {
  background: #fff;
  color: var(--primary);
}

.search-input-box {
  display: flex;
  background: #fff;
  border-radius: 35px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  overflow: hidden;
  padding: 4px;
}

.search-input-box input {
  flex: 1;
  border: none;
  padding: 16px 24px;
  font-size: 1.1rem;
  outline: none;
  color: var(--slate-800);
}

.search-input-box button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-input-box button:hover {
  background: var(--primary-hover);
}

/* Live Dropdown Results */
.live-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  text-align: left;
  border: 1px solid var(--slate-200);
}

.search-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  transition: background 0.15s;
}

.search-item:hover, .search-item.selected {
  background-color: var(--primary-light);
}

.search-item-info h4 {
  font-size: 1rem;
  color: var(--slate-800);
  font-weight: 700;
  margin-bottom: 2px;
}

.search-item-info p {
  font-size: 0.85rem;
  color: var(--slate-600);
}

.search-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.search-badge.Medicine { background: #e0f2fe; color: #0369a1; }
.search-badge.Generic { background: #fef3c7; color: #b45309; }
.search-badge.Company { background: #dcfce7; color: #15803d; }
.search-badge.Doctor { background: #f3e8ff; color: #7e22ce; }

.search-price {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

/* Content Sections */
.section {
  padding: 50px 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 25px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--slate-800);
}

.section-subtitle {
  color: var(--slate-600);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* Grid Layouts */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-medicine {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-medicine .dosage-badge {
  display: inline-block;
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.card-medicine .brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 2px;
}

.card-medicine .generic-title {
  font-size: 0.85rem;
  color: var(--slate-600);
  margin-bottom: 6px;
}

.card-medicine .company-title {
  font-size: 0.85rem;
  color: var(--slate-400);
  margin-bottom: 12px;
}

.card-medicine .price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--slate-200);
  padding-top: 12px;
  margin-top: auto;
}

.card-medicine .unit-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

/* Detail Pages */
.detail-header {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 30px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

.detail-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-hover);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.detail-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--slate-800);
  margin-bottom: 6px;
}

.detail-meta {
  font-size: 1.05rem;
  color: var(--slate-600);
  margin-bottom: 16px;
}

.detail-price-box {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: inline-flex;
  gap: 30px;
}

.price-item span {
  display: block;
  font-size: 0.85rem;
  color: var(--slate-600);
}

.price-item strong {
  font-size: 1.4rem;
  color: var(--primary);
}

/* Pharmacology Accordion / Sections */
.info-block {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.info-block h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 14px;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 8px;
}

.info-block p {
  color: var(--slate-800);
  line-height: 1.8;
  white-space: pre-line;
}

/* Substitutes Table */
.substitutes-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.substitutes-table th, .substitutes-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
  font-size: 0.95rem;
}

.substitutes-table th {
  background-color: var(--slate-100);
  color: var(--slate-600);
  font-weight: 600;
}

.substitutes-table tr:hover {
  background-color: var(--slate-50);
}

/* Doctors Card */
.doctor-card {
  display: flex;
  gap: 18px;
}

.doctor-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--slate-400);
  flex-shrink: 0;
}

.doctor-info h4 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--slate-800);
  margin-bottom: 4px;
}

.doctor-specialty {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.doctor-degree {
  font-size: 0.85rem;
  color: var(--slate-600);
  margin-bottom: 8px;
}

/* Footer */
.footer {
  background: var(--dark);
  color: var(--slate-400);
  padding: 60px 0 30px 0;
  margin-top: 60px;
  font-size: 0.95rem;
}

.footer h4 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 18px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--slate-400);
}

.footer-links a:hover {
  color: #fff;
}

.disclaimer-box {
  background: rgba(255, 255, 255, 0.05);
  border-left: 4px solid var(--primary);
  padding: 16px;
  margin-top: 30px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.6;
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 25px;
  margin-top: 40px;
  font-size: 0.85rem;
}

/* Admin Styles */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 250px;
  background: var(--dark);
  color: #fff;
  padding: 20px 0;
  flex-shrink: 0;
}

.admin-sidebar-header {
  padding: 0 20px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.admin-nav {
  list-style: none;
  margin-top: 20px;
}

.admin-nav a {
  display: block;
  padding: 12px 20px;
  color: var(--slate-400);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.admin-nav a:hover, .admin-nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-left: 4px solid var(--primary);
}

.admin-main {
  flex: 1;
  background: var(--slate-50);
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: #fff;
  padding: 16px 30px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-content {
  padding: 30px;
  flex: 1;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--slate-800);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--slate-200); color: var(--slate-800); }
.btn-secondary:hover { background: var(--slate-400); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.85rem; }

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsive System (320px - 992px)
   ========================================================================== */

/* Table Scrollability & Touch Defaults */
.table-responsive,
.card > table,
table.substitutes-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Breakpoint 1: Screen Width <= 992px (Tablets & Mobile Viewport)
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  /* Prevent background scrolling when mobile nav is open */
  body.nav-open,
  body.admin-sidebar-open {
    overflow: hidden;
  }

  /* Desktop-only elements hidden on mobile */
  .desktop-only {
    display: none !important;
  }

  /* Main Navbar Mobile Header */
  .navbar .container,
  .navbar-container {
    height: 62px;
    padding: 0 16px;
  }

  .navbar-brand {
    font-size: 1.3rem;
    gap: 8px;
  }

  /* Mobile Actions (Lang switch + Hamburger) */
  .navbar-mobile-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    color: var(--slate-700);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s;
  }

  .mobile-lang-btn:hover {
    background: var(--slate-200);
  }

  /* Hamburger Toggler Button */
  .navbar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 1.5px solid var(--slate-200);
    border-radius: 10px;
    color: var(--slate-800);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }

  .navbar-toggler:hover,
  .navbar-toggler:active {
    background: var(--slate-100);
    color: var(--primary);
    border-color: var(--primary);
  }

  .navbar-toggler .close-icon {
    display: none !important;
  }

  .navbar-toggler.active {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
  }

  .navbar-toggler.active .hamburger-icon {
    display: none !important;
  }

  .navbar-toggler.active .close-icon {
    display: block !important;
  }

  /* Mobile Navigation Off-canvas Drawer */
  .navbar-collapse {
    position: fixed;
    top: 0;
    left: 0;
    width: 325px;
    max-width: 88vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    background: #ffffff;
    z-index: 1100;
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    margin: 0;
    overflow: hidden !important;
  }

  .navbar-collapse.show {
    transform: translateX(0);
  }

  /* Fixed Mobile Drawer Header */
  .mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--slate-200);
    background: #ffffff;
    flex-shrink: 0;
    z-index: 10;
  }

  .mobile-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    color: var(--slate-600);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
  }

  .mobile-drawer-close:hover,
  .mobile-drawer-close:active {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
  }

  /* Scrollable Body: Smooth Touch & Mouse Wheel Scrolling */
  .navbar-drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    display: flex;
    flex-direction: column;
    padding-bottom: 95px;
  }

  /* Custom Clean Scrollbar for Drawer */
  .navbar-drawer-body::-webkit-scrollbar {
    width: 5px;
  }
  .navbar-drawer-body::-webkit-scrollbar-track {
    background: #f8fafc;
  }
  .navbar-drawer-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
  }
  .navbar-drawer-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
  }

  /* Mobile Navigation List */
  .navbar-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px 0;
    gap: 0;
    flex-shrink: 0;
  }

  .navbar-nav .nav-item {
    width: 100%;
    border-bottom: 1px solid #f1f5f9;
  }

  .nav-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .nav-item-row:hover,
  .nav-item-row:active {
    background: #f8fafc;
  }

  .nav-link {
    flex: 1;
    padding: 14px 18px;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--slate-800);
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-link:hover, .nav-link:active {
    color: var(--primary);
  }

  /* Mobile Submenu Accordion Arrow */
  .mobile-submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    border-left: 1px solid #f1f5f9;
    color: var(--slate-400);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-submenu-toggle svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-submenu-toggle.active svg,
  .nav-item.dropdown.show .mobile-submenu-toggle svg {
    transform: rotate(180deg);
    color: var(--primary);
  }

  .nav-item.dropdown.show > .nav-item-row {
    background: #f0fdfa;
    border-left: 3.5px solid var(--primary);
  }

  .nav-item.dropdown.show > .nav-item-row .nav-link {
    color: var(--primary);
  }

  /* Smooth Sliding Submenu Accordion (Zero Jump) */
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: #f8fafc;
    border-left: 3.5px solid var(--primary);
    border-radius: 8px;
    margin: 0 12px 0 18px;
    padding: 0 4px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    display: block !important;
    visibility: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.3s ease, padding 0.3s ease, visibility 0.35s;
    transform: none;
  }

  .dropdown-menu.dropdown-menu-wide {
    display: block !important;
    min-width: auto;
    grid-template-columns: none;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    margin: 0 12px 0 18px;
    padding: 0 4px;
  }

  .nav-item.dropdown.show .dropdown-menu,
  .nav-item.dropdown.show .dropdown-menu.dropdown-menu-wide {
    max-height: 1800px !important;
    opacity: 1 !important;
    visibility: visible !important;
    margin: 4px 12px 12px 18px !important;
    padding: 6px 4px !important;
  }

  .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--slate-700);
    text-decoration: none;
    border-radius: 6px;
    border-bottom: 1px dashed #e2e8f0;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .dropdown-item:last-child {
    border-bottom: none;
  }

  .dropdown-item:active,
  .dropdown-item:hover {
    background: #e2e8f0;
    color: var(--primary);
    padding-left: 18px;
  }

  /* Mobile Drawer Footer Actions */
  .mobile-drawer-footer {
    display: block;
    margin-top: auto;
    padding: 20px 16px;
    border-top: 1px solid var(--slate-200);
    background: var(--slate-50);
    flex-shrink: 0;
  }

  .btn-mobile-hotline {
    background: #ecfdf5;
    color: #047857;
    font-weight: 700;
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px;
    margin-bottom: 8px;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    text-decoration: none;
  }

  .btn-mobile-emergency {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 700;
    width: 100%;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    text-decoration: none;
  }

  /* Backdrop Overlay for Mobile Nav */
  .navbar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1090;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .navbar-backdrop.show {
    opacity: 1;
    visibility: visible;
  }

  /* ------------------------------------------------------------------------
     Admin Mobile Responsiveness
     ------------------------------------------------------------------------ */
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 6px 0 25px rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-sidebar-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 16px 20px !important;
  }

  .admin-sidebar-close {
    display: inline-block !important;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
  }

  .admin-sidebar-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    padding: 7px 13px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--slate-800);
    cursor: pointer;
    transition: background 0.15s;
  }

  .admin-sidebar-toggle:hover {
    background: var(--slate-200);
  }

  .admin-sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .admin-sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
  }

  .admin-main {
    width: 100%;
    min-width: 0;
  }

  .admin-topbar {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .admin-content {
    padding: 18px 14px;
  }
}

/* --------------------------------------------------------------------------
   Breakpoint 2: Screen Width <= 900px (Universal Grid & Sidebar Collapse)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  /* Force all 2-column, 3-column & sidebar grids to stack cleanly */
  .grid-2,
  .grid-3,
  [style*="grid-template-columns: 2.2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns: 280px 1fr"],
  [style*="grid-template-columns: 300px 1fr"],
  [style*="grid-template-columns: 2fr 1fr 1fr 2fr auto"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* Unstick sticky sidebars when stacked vertically */
  [style*="position: sticky"],
  [style*="position:sticky"] {
    position: static !important;
    top: auto !important;
  }

  /* Admin Header User Prefix */
  .admin-user-prefix {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Breakpoint 3: Screen Width <= 768px (Mobile Handsets)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .section {
    padding: 32px 0;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 18px;
  }

  .section-title {
    font-size: 1.35rem;
  }

  /* Hero Section & Search Box */
  .hero-section {
    padding: 35px 0 50px 0;
  }

  .hero-title {
    font-size: 1.7rem;
    line-height: 1.3;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    margin-bottom: 22px;
  }

  /* Search Tabs: Smooth horizontal touch scrollable pills */
  .search-tabs {
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
    padding: 4px 2px 8px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 6px;
  }

  .search-tabs::-webkit-scrollbar {
    display: none;
  }

  .search-tab-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: 0.82rem;
  }

  .search-input-box {
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  }

  .search-input-box input {
    padding: 12px 16px;
    font-size: 0.98rem;
  }

  .search-input-box button {
    padding: 0 18px;
    font-size: 0.9rem;
  }

  .live-search-dropdown {
    max-height: 55vh;
  }

  /* Stats Bar on Mobile: 2-column or clean wraps */
  [style*="justify-content: space-around"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
    text-align: center !important;
  }

  /* Medicine Detail & Pricing */
  .detail-header {
    padding: 20px 16px;
    margin-bottom: 20px;
  }

  .detail-title {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .detail-price-box {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 14px;
    padding: 12px 14px;
  }

  .price-item strong {
    font-size: 1.15rem;
  }

  /* Doctor Card on Mobile */
  .doctor-card {
    flex-direction: column;
    gap: 12px;
  }

  .doctor-avatar {
    width: 52px;
    height: 52px;
  }

  /* Banner Cards (Women/Men Corner, Emergency, Lab, SaaS) */
  [style*="linear-gradient"][style*="border-radius: 16px"] {
    padding: 22px 16px !important;
    border-radius: 14px !important;
  }

  [style*="linear-gradient"] h1 {
    font-size: 1.45rem !important;
    line-height: 1.3 !important;
  }

  [style*="linear-gradient"] p {
    font-size: 0.92rem !important;
    line-height: 1.5 !important;
  }

  /* Forms & Touch Inputs: 16px prevents iOS Safari auto-zoom */
  .form-control,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Form button blocks */
  .btn {
    padding: 11px 18px;
    font-size: 0.92rem;
  }

  /* Emergency Hub & Call to Action Buttons */
  .tel-btn-large {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    padding: 12px !important;
    font-size: 1rem !important;
  }

  /* Footer */
  .footer {
    padding: 35px 0 20px 0;
  }

  .footer [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 25px !important;
  }
}

/* --------------------------------------------------------------------------
   Breakpoint 4: Screen Width <= 480px (Small Handsets e.g. iPhone SE)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  /* Prevent any card grid minmax from causing horizontal overflow */
  [style*="minmax(360px"],
  [style*="minmax(350px"],
  [style*="minmax(340px"],
  [style*="minmax(320px"],
  [style*="minmax(300px"],
  [style*="minmax(280px"],
  [style*="minmax(260px"],
  .grid-4 {
    grid-template-columns: 1fr !important;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .navbar-brand {
    font-size: 1.15rem;
  }

  .navbar-brand svg {
    width: 26px;
    height: 26px;
  }

  /* Topbar admin button */
  .admin-toggle-text {
    display: none;
  }

  .admin-topbar h2 {
    font-size: 1rem !important;
  }
}

/* ==========================================================================
   365-Day Subscription 5-Day Expiration Warning Banner
   ========================================================================== */
.license-warning-sticky {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  color: #ffffff;
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 9999;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
  font-size: 0.92rem;
  border-bottom: 2px solid #991b1b;
}

.license-warning-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.license-warning-text {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}

.license-warning-icon {
  font-size: 1.3rem;
  animation: pulse-icon 1.5s infinite;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.license-badge-days {
  background: #ffffff;
  color: #dc2626;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  margin: 0 4px;
}

.license-warning-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.license-renew-btn {
  background: #ffffff;
  color: #991b1b !important;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  white-space: nowrap;
}

.license-renew-btn:hover {
  background: #fee2e2;
  color: #7f1d1d !important;
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (Handsets < 768px)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body {
    padding-bottom: 65px; /* Reserve space for fixed bottom bar */
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #ffffff;
    border-top: 1px solid var(--slate-200);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--slate-600);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
    font-family: inherit;
  }

  .bottom-nav-item:active,
  .bottom-nav-item:hover {
    color: var(--primary);
  }

  .bottom-nav-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-bottom: 2px;
  }

  .bottom-nav-label {
    font-size: 0.72rem;
    font-weight: 700;
  }

  .bottom-nav-item.emergency-highlight {
    color: #dc2626;
  }

  .bottom-nav-item.emergency-highlight .bottom-nav-label {
    color: #dc2626;
    font-weight: 800;
  }
}

