/* Dashboard Layout Styles */
:root {
  --sidebar-width: 285px;
  --sidebar-bg: #124da0; /* Primary color */
  --sidebar-gradient: radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.08) 0%, transparent 60%), linear-gradient(180deg, #175bb8 0%, #124da0 60%, #0d3d82 100%);
  --sidebar-active-bg: #2b77e5;
  --dashboard-bg: #f5f6fb;
}

body.dashboard-layout {
  background: var(--dashboard-bg);
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  font-family: var(--font-1);
}

/* Sidebar */
.dashboard-sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  background-image: var(--sidebar-gradient);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.35s ease;
  will-change: transform;
}

.sidebar-logo {
  padding: 14px 20px 8px 20px;
  text-align: center;
  background-color: white;
  border-bottom-right-radius: 30px;
}

.sidebar-logo img {
  max-width: 145px;
}

.offit-topbar-logo-img {
  height: 38px !important;
  width: auto !important;
  max-width: 180px !important;
  object-fit: contain !important;
  display: block !important;
}

.sidebar-menu {
  list-style: none;
  padding: 8px 14px 20px 14px;
  margin: 0;
  flex-grow: 1;
}

.sidebar-menu li {
  margin-bottom: 5px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.sidebar-menu a i {
  margin-right: 12px;
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-menu a:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.sidebar-menu a.active {
  background-color: var(--sidebar-active-bg);
  box-shadow: 0 4px 14px rgba(14, 58, 122, 0.3);
  border-left: 4px solid white;
}

.sidebar-footer {
  padding: 20px 15px;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.7);
}

/* Main Content */
.dashboard-main {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}

/* Topbar */
.dashboard-topbar {
  background-color: var(--dashboard-bg, #f5f6fb);
  padding: 8px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 999;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.2s ease,
              box-shadow 0.2s ease,
              border-color 0.2s ease;
  will-change: transform;
}

/* Scrolled state: Solid, frosted backdrop with subtle shadow and border */
.dashboard-topbar.topbar-scrolled {
  background-color: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

/* Auto-hide state on scroll down */
.dashboard-topbar.topbar-hidden {
  transform: translateY(-115%) !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

/* Topbar Search & Autocomplete Dropdown */
.topbar-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-search {
  background-color: #f1f5f9;
  border-radius: 9999px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  border: 1.5px solid #e2e8f0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.topbar-search:focus-within,
.topbar-search-wrapper.is-open .topbar-search {
  width: 100%;
  border-color: #3b82f6;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.14), 0 0 0 3px rgba(59, 130, 246, 0.1);
  background-color: #ffffff;
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  margin-left: 10px;
  width: 100%;
  font-size: 0.88rem;
  color: #1e293b;
  font-family: inherit;
}

.topbar-search input::placeholder {
  color: #94a3b8;
  font-size: 0.875rem;
}

.topbar-search .search-icon {
  color: #64748b;
  font-size: 0.95rem;
  transition: color 0.2s;
  flex-shrink: 0;
}

.topbar-search:focus-within .search-icon {
  color: #2563eb;
}

.topbar-search .search-clear-btn {
  background: none;
  border: none;
  padding: 0 2px;
  margin-left: 6px;
  color: #94a3b8;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.topbar-search .search-clear-btn:hover {
  color: #ef4444;
}

.topbar-search .search-clear-btn.visible {
  display: flex;
}

/* Google-Style Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 440px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.16), 0 6px 16px rgba(15, 23, 42, 0.05);
  z-index: 1050;
  overflow: hidden;
  display: none;
  animation: searchDropSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Prompt', 'Inter', sans-serif;
}

@keyframes searchDropSlide {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.search-dropdown-header {
  padding: 11px 18px 9px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.search-dropdown-header .search-result-count {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 2px 8px;
  background: #e2e8f0;
  color: #475569;
  border-radius: 9999px;
}

.search-dropdown-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
  margin: 0;
  list-style: none;
}

/* Custom Scrollbar */
.search-dropdown-list::-webkit-scrollbar {
  width: 6px;
}
.search-dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}
.search-dropdown-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.search-dropdown-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none !important;
  color: inherit !important;
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}

.search-dropdown-item:hover,
.search-dropdown-item.active {
  background-color: #eff6ff;
  transform: translateX(2px);
}

.search-dropdown-item.active {
  box-shadow: inset 3.5px 0 0 #2563eb;
}

.search-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.search-dropdown-item:hover .search-item-icon,
.search-dropdown-item.active .search-item-icon {
  transform: scale(1.08);
}

.search-item-content {
  flex: 1;
  min-width: 0;
}

.search-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.search-item-desc {
  font-size: 0.875rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.search-item-badge {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-item-arrow {
  color: #94a3b8;
  font-size: 1.1rem;
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.search-dropdown-item:hover .search-item-arrow,
.search-dropdown-item.active .search-item-arrow {
  opacity: 1;
  transform: translateX(0);
  color: #2563eb;
}

/* Match Highlight (Google style) */
.search-highlight {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
  font-weight: 700;
  padding: 0 1px;
  margin: 0;
  border-radius: 2px;
  display: inline;
}

/* Empty State */
.search-empty-state {
  padding: 36px 20px;
  text-align: center;
  color: #64748b;
}

.search-empty-state i {
  font-size: 2.2rem;
  color: #cbd5e1;
  margin-bottom: 10px;
  display: block;
}

.search-empty-state .empty-title {
  font-weight: 600;
  color: #334155;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.search-empty-state .empty-hint {
  font-size: 0.875rem;
  color: #94a3b8;
}

/* Dropdown Footer with Keyboard Hints */
.search-dropdown-footer {
  padding: 8px 16px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: #94a3b8;
}

.search-dropdown-footer .search-kbd-hints {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-dropdown-footer kbd {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 0.875rem;
  color: #475569;
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

@media (max-width: 767.98px) {
  .dashboard-topbar {
    padding: 12px 18px;
  }
  .topbar-search {
    width: 210px;
    padding: 6px 14px;
  }
  .topbar-search:focus-within,
  .topbar-search-wrapper.is-open .topbar-search {
    width: 245px;
  }
  .topbar-search input {
    font-size: 0.875rem;
  }
  .search-dropdown {
    width: auto;
    position: fixed;
    top: 68px;
    left: 14px;
    right: 14px;
    max-width: calc(100vw - 28px);
  }
}

@media (max-width: 575.98px) {
  .dashboard-topbar {
    padding: 10px 12px;
    gap: 8px;
  }
  .topbar-search {
    width: 160px;
    padding: 5px 10px;
  }
  .topbar-search:focus-within,
  .topbar-search-wrapper.is-open .topbar-search {
    width: 195px;
  }
  .topbar-search input {
    font-size: 0.875rem;
    margin-left: 6px;
  }
  .topbar-search input::placeholder {
    font-size: 0.875rem;
  }
  .search-dropdown {
    top: 62px;
    left: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.offit-btn-contact {
  background: #f0f6ff;
  color: #1868d4 !important;
  border: 1px solid #d0e2ff;
  border-radius: 50px;
  padding: 7px 16px;
  font-weight: 500;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none !important;
  white-space: nowrap;
  transition: all 0.2s ease;
  line-height: 1;
}

.offit-btn-contact i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1 !important;
  vertical-align: 0 !important;
  width: 1em;
  height: 1em;
}

.offit-btn-contact i::before {
  display: block;
  line-height: 1 !important;
  vertical-align: 0 !important;
}

.offit-btn-contact:hover {
  background: #1868d4;
  color: #ffffff !important;
  border-color: #1868d4;
  box-shadow: 0 4px 12px rgba(24, 104, 212, 0.2);
}

.offit-btn-contact:active {
  transform: translateY(1px);
}

@media (max-width: 576px) {
  .topbar-actions {
    gap: 10px;
  }
  .offit-btn-contact {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
  }
  .offit-btn-contact i {
    font-size: 1.15rem;
    margin: 0 !important;
  }
}

.topbar-notification {
  position: relative;
  cursor: pointer;
}

.topbar-notification i {
  font-size: 1.2rem;
  color: #555;
}

.topbar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  text-decoration: none;
}

.topbar-profile.dropdown-toggle::after {
  display: none !important;
}

.topbar-profile:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Dashboard Topbar User Dropdown Menu */
.dashboard-topbar .dropdown-menu,
.offit-home-topbar .dropdown-menu {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05) !important;
  border-radius: 16px !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  padding: 8px 6px !important;
  min-width: 240px !important;
  z-index: 1060 !important;
  margin-top: 10px !important;
}

.dashboard-topbar .dropdown-item,
.offit-home-topbar .dropdown-item {
  border-radius: 10px !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  color: #334155 !important;
  padding: 8px 14px !important;
  display: flex !important;
  align-items: center !important;
  transition: all 0.15s ease !important;
}

.dashboard-topbar .dropdown-item:hover,
.offit-home-topbar .dropdown-item:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  transform: translateX(2px);
}

.dashboard-topbar .dropdown-item.active,
.dashboard-topbar .dropdown-item:active,
.offit-home-topbar .dropdown-item.active,
.offit-home-topbar .dropdown-item:active {
  background-color: #eff6ff !important;
  color: #2563eb !important;
  font-weight: 600 !important;
}

/* Logout Menu Item - Soft Pastel Red (แดงพาสเทล) */
.dashboard-topbar .dropdown-item.text-danger,
.dashboard-topbar .dropdown-item.dropdown-item-logout,
.offit-home-topbar .dropdown-item.text-danger,
.offit-home-topbar .dropdown-item.dropdown-item-logout,
.offit-topbar-actions .dropdown-item.text-danger,
.offit-topbar-actions .dropdown-item.dropdown-item-logout,
.dropdown-menu .dropdown-item.text-danger,
.dropdown-menu .dropdown-item.dropdown-item-logout,
.dropdown-item-logout {
  color: #e57373 !important;
}

.dashboard-topbar .dropdown-item.text-danger i,
.dashboard-topbar .dropdown-item.dropdown-item-logout i,
.offit-home-topbar .dropdown-item.text-danger i,
.offit-home-topbar .dropdown-item.dropdown-item-logout i,
.offit-topbar-actions .dropdown-item.text-danger i,
.offit-topbar-actions .dropdown-item.dropdown-item-logout i,
.dropdown-menu .dropdown-item.text-danger i,
.dropdown-menu .dropdown-item.dropdown-item-logout i,
.dropdown-item-logout i {
  color: #e57373 !important;
  transition: color 0.15s ease !important;
}

.dashboard-topbar .dropdown-item.text-danger:hover,
.dashboard-topbar .dropdown-item.dropdown-item-logout:hover,
.offit-home-topbar .dropdown-item.text-danger:hover,
.offit-home-topbar .dropdown-item.dropdown-item-logout:hover,
.offit-topbar-actions .dropdown-item.text-danger:hover,
.offit-topbar-actions .dropdown-item.dropdown-item-logout:hover,
.dropdown-menu .dropdown-item.text-danger:hover,
.dropdown-menu .dropdown-item.dropdown-item-logout:hover,
.dropdown-item-logout:hover {
  background-color: #fff5f5 !important;
  color: #d9534f !important;
}

.dashboard-topbar .dropdown-item.text-danger:hover i,
.dashboard-topbar .dropdown-item.dropdown-item-logout:hover i,
.offit-home-topbar .dropdown-item.text-danger:hover i,
.offit-home-topbar .dropdown-item.dropdown-item-logout:hover i,
.offit-topbar-actions .dropdown-item.text-danger:hover i,
.offit-topbar-actions .dropdown-item.dropdown-item-logout:hover i,
.dropdown-menu .dropdown-item.text-danger:hover i,
.dropdown-menu .dropdown-item.dropdown-item-logout:hover i,
.dropdown-item-logout:hover i {
  color: #d9534f !important;
}

@media (max-width: 575.98px) {
  .dashboard-topbar .dropdown-menu {
    max-width: calc(100vw - 24px) !important;
    right: 0 !important;
    left: auto !important;
  }
}

.profile-img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background-color: #2c599d;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 0.875rem;
  font-weight: bold;
  color: #333;
}

.profile-role {
  font-size: 0.875rem;
  color: #777;
}

/* Content Area */
.dashboard-content {
  padding: 10px 18px 28px 18px;
  flex-grow: 1;
}

/* Global Card & Container Spacing (Balanced +15%) */
.card-body {
  padding: 1.15rem 1.05rem !important;
}

.card.p-4,
.card.p-5 {
  padding: 1.35rem 1.15rem !important;
}

/* Dashboard Banner */
.dashboard-banner {
  background: linear-gradient(135deg, #e8f0fe 0%, #fbebed 100%);
  border-radius: 20px;
  padding: 30px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.banner-text h2 {
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.banner-text p {
  color: #555;
  font-size: 1.1rem;
}

.banner-img {
  max-width: 300px;
  position: relative;
  z-index: 2;
}

/* Menu Cards */
.menu-cards-row {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.menu-card {
  background: white;
  border-radius: 15px;
  padding: 20px;
  min-width: 180px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: #333;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  transition: transform 0.2s, box-shadow 0.2s;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
  color: var(--primary-color);
}

.menu-card .icon-container {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #f5f8ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

.menu-card .icon-container img {
  max-width: 35px;
}

.menu-card h5 {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
}

/* Sidebar Toggle for Mobile */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary-color);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color 0.2s, transform 0.15s;
}

.sidebar-toggle:active {
  transform: scale(0.92);
}

@media (max-width: 991px) {
  /* Dimmed backdrop overlay on mobile */
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.35s ease;
    pointer-events: none;
    cursor: pointer;
  }

  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .dashboard-sidebar {
    transform: translateX(-100%);
    z-index: 1050;
    box-shadow: none;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.35s ease;
  }
  
  .dashboard-sidebar.show {
    transform: translateX(0);
    box-shadow: 12px 0 35px rgba(0, 0, 0, 0.28);
  }

  body.sidebar-open {
    overflow: hidden;
  }
  
  .dashboard-main {
    margin-left: 0;
    width: 100%;
  }

  .dashboard-topbar {
    padding: 10px 12px;
  }

  .dashboard-content {
    padding: 12px 12px;
  }

  .topbar-search {
    width: 200px;
    padding: 6px 12px;
  }

  .topbar-search input {
    font-size: 0.875rem;
  }

  .topbar-search:focus-within,
  .topbar-search-wrapper.is-open .topbar-search {
    width: 240px;
  }

  /* Screen edge padding for containers (+15%) */
  .container,
  .container-fluid,
  #tailwind-widget,
  .rosa-container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Card padding on mobile (+15%) */
  .card-body {
    padding: 0.85rem 0.75rem !important;
  }

  .card.p-4,
  .card.p-5 {
    padding: 0.95rem 0.8rem !important;
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .dashboard-banner {
    flex-direction: column;
    text-align: center;
    padding: 20px 16px;
  }
  
  .banner-img {
    margin-top: 20px;
    max-width: 200px;
  }
}

@media (max-width: 576px) {
  .dashboard-topbar {
    padding: 8px 10px;
  }

  .dashboard-content {
    padding: 10px 10px;
  }

  .topbar-search {
    width: 145px;
    padding: 5px 8px;
  }

  .topbar-search input {
    font-size: 0.875rem;
  }

  .topbar-search input::placeholder {
    font-size: 0.875rem;
  }

  .topbar-search:focus-within,
  .topbar-search-wrapper.is-open .topbar-search {
    width: 175px;
  }

  .container,
  .container-fluid,
  #tailwind-widget,
  .rosa-container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .card-body {
    padding: 0.75rem 0.65rem !important;
  }

  .card.p-4,
  .card.p-5 {
    padding: 0.85rem 0.7rem !important;
  }
}

/* ========================================================
   Readability / Typography (global)
   - min font size, comfortable line-height, Thai word wrapping
   ======================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
p, li, td, th, label, .card-text, .form-control, .form-select, .btn { line-height: 1.6; }
p, li, td, th, h1, h2, h3, h4, h5, h6, .card-title, .card-text, a, span, label {
  overflow-wrap: break-word;
  word-break: normal;
  line-break: auto;
}
h1, h2, h3, h4, h5, h6 { line-height: 1.35; }
small, .small, .text-muted.small { font-size: 0.875rem; }
.form-control, .form-select, input, select, textarea { font-size: 1rem; }
@media (max-width: 576px) {
  body { font-size: 15px; }
  h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
  h2 { font-size: clamp(1.3rem, 5.2vw, 1.7rem); }
  h3 { font-size: clamp(1.15rem, 4.6vw, 1.4rem); }
  .form-control, .form-select, input, select, textarea { font-size: 16px; }
}


/* ==========================================================================
   Universal Modal / Pop-Up Card Scroll Lock & Drag Protection
   Prevents background webpage from moving/scrolling while popup is open
   ========================================================================== */
html {
  scrollbar-gutter: stable;
}

html.modal-open,
body.modal-open,
html.popup-open,
body.popup-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* On desktop (>= 992px), preserve overflow and scrollbar so position:sticky sidebar doesn't break or jump */
@media (min-width: 992px) {
  html.modal-open,
  html.popup-open {
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }
  body.modal-open,
  body.popup-open {
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }
}

/* Trap overscroll on all pop-up modals and cards */
#office-syndrome-modal,
#ncd-detail-modal,
#card-help-modal,
#rosa-detail-modal,
.widget-modal-overlay,
#choiceModal,
#advice-modal,
#time-picker-modal,
#modalTouchCalendar,
#landscape-prompt-modal,
#set-tracker-modal,
#picker-modal,
#choice-modal,
#alert-modal,
#contactSuccessModal,
.modal.show,
.modal-overlay {
  overscroll-behavior: contain !important;
  touch-action: none;
}

/* Ensure designated scrollable containers inside popups can scroll smoothly */
#office-syndrome-modal .overflow-y-auto,
#ncd-detail-modal .overflow-y-auto,
#card-help-modal .overflow-y-auto,
#advice-modal .overflow-y-auto,
#choiceModal .overflow-y-auto,
#choiceModal .modal-body-scroll,
.widget-modal-overlay .rosa-widget-card,
.widget-modal-overlay .rosa-widget-card > div,
.widget-modal-overlay .overflow-y-auto,
#set-tracker-modal .set-modal-card,
#modalTouchCalendar .modal-card-content,
.modal-body,
body.modal-open .overflow-y-auto,
body.modal-open [class*="overflow-y-auto"],
body.popup-open .overflow-y-auto,
body.popup-open [class*="overflow-y-auto"] {
  overscroll-behavior: contain !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y !important;
}

/* Prevent image dragging inside modals/popups from ghost-dragging or scrolling background */
#office-syndrome-modal img,
#ncd-detail-modal img,
#card-help-modal img,
#advice-modal img,
#choiceModal img,
.widget-modal-overlay img,
.rosa-widget-card img,
.modal-content img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

