/* PageHeader.css - Comprehensive Responsive Design with Navigation Integration */

/* ============================= */
/* Base Styles */
/* ============================= */

/* Main Navigation Bar */
.main-navigation {
  background: var(--surface-color, white);
  border-bottom: 1px solid #e5e7eb;
  padding: 0;
  position: sticky;
  top: 72px; /* Below header */
  z-index: 40;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.main-navigation .nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main-navigation .nav-items {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.main-navigation .nav-items::-webkit-scrollbar {
  height: 4px;
}

.main-navigation .nav-items::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.main-navigation .nav-items::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 2px;
}

.main-navigation .nav-items a {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  color: #4b5563;
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.main-navigation .nav-items a:hover {
  color: #3b82f6;
  background: #f0f9ff;
  border-bottom-color: #93c5fd;
}

.main-navigation .nav-items a.active {
  color: #2563eb;
  background: #eff6ff;
  border-bottom-color: #3b82f6;
}

.page-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 1rem 2rem !important;
  background: var(--surface-color, white) !important;
  border-bottom: 1px solid #e5e7eb !important;
  margin-bottom: 0 !important;
  min-height: 72px !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.page-header .header-left,
.page-header .header-right {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
}

.page-header .header-left {
  justify-content: flex-start !important;
}

.page-header .header-right {
  justify-content: flex-end !important;
}

.page-header .header-center {
  flex: 2 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.page-title {
  margin: 0 !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: #1f2937 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  white-space: nowrap !important;
  letter-spacing: -0.025em !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
}

/* Medical page title should be white */
.medical-page-header .page-title {
  color: var(--color-text-light, white) !important;
  font-size: 1.8rem !important;
}

.page-header .title-icon {
  font-size: 1.5rem !important;
}

.page-header .back-button {
  background: none !important;
  border: 1px solid var(--border-color, #ccc) !important;
  color: var(--text-secondary, #666) !important;
  padding: 0.5rem 1rem !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-size: 0.9rem !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  text-decoration: none !important;
  font-weight: normal !important;
}

.page-header .back-button:hover {
  background: var(--background-hover, #f0f0f0) !important;
  color: var(--text-primary, #333) !important;
  border-color: var(--border-hover, #999) !important;
}

/* Medical page back button should be white with transparent background */
.medical-page-header .back-button {
  background: rgba(255, 255, 255, 0.2) !important;
  color: var(--color-text-light, white) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  font-weight: 500 !important;
}

.medical-page-header .back-button:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: var(--color-text-light, white) !important;
}

.page-header .header-actions {
  display: flex !important;
  align-items: center !important;
  gap: clamp(0.25rem, 1vw, 1rem) !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
  min-width: 0 !important;
}

/* Global actions styling */
.global-actions {
  display: flex !important;
  align-items: center !important;
  gap: clamp(0.25rem, 1vw, 0.75rem) !important;
  margin-left: clamp(0.5rem, 2vw, 1rem) !important;
  padding-left: clamp(0.5rem, 2vw, 1rem) !important;
  border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Medical page global actions */
.medical-page-header .global-actions {
  border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.global-actions .settings-button,
.global-actions .logout-btn {
  background: none !important;
  border: 1px solid var(--border-color, #ccc) !important;
  color: var(--text-secondary, #666) !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-size: 0.9rem !important;
  transition: all 0.2s ease !important;
  font-weight: 500 !important;
}

.global-actions .settings-button:hover,
.global-actions .logout-btn:hover {
  background: var(--background-hover, #f0f0f0) !important;
  color: var(--text-primary, #333) !important;
  border-color: var(--border-hover, #999) !important;
}

/* Dashboard variant styles */
.dashboard-header {
  background: linear-gradient(
    135deg,
    var(--color-primary, #667eea) 0%,
    var(--color-primary-dark, #764ba2) 100%
  ) !important;
  color: var(--color-text-light, white) !important;
  box-shadow: var(--shadow-md, 0 2px 10px rgba(0, 0, 0, 0.1)) !important;
  border-bottom: 2px solid var(--border-color);
  padding: 1rem 2rem !important;
}

.dashboard-header .page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text-light, white) !important;
}

/* Medical page variant styles */
.medical-page-header {
  background: linear-gradient(
    135deg,
    var(--color-primary, #667eea) 0%,
    var(--color-primary-dark, #764ba2) 100%
  ) !important;
  color: var(--color-text-light, white) !important;
  box-shadow: var(--shadow-md, 0 2px 10px rgba(0, 0, 0, 0.1)) !important;
  padding: 1rem 2rem !important;
}

/* ============================= */
/* Desktop Navigation Bar */
/* ============================= */

.desktop-nav-bar {
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: block !important;
  visibility: visible !important;
  position: relative;
  overflow: visible !important;
  z-index: 100;
}

.desktop-nav-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem clamp(0.5rem, 2vw, 2rem);
  display: flex;
  gap: clamp(0.25rem, 1vw, 1rem);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  overflow: visible;
}

/* Navigation Dropdown Styles */
.nav-dropdown-trigger {
  background: transparent !important;
  color: var(--color-text-primary, #333) !important;
  border: 1px solid transparent !important;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-dropdown-trigger:hover {
  background: var(--color-background-secondary, #f8f9fa) !important;
  color: var(--color-primary, #667eea) !important;
}

.nav-dropdown-trigger.active {
  background: var(--color-primary-light, #e8f2ff) !important;
  color: var(--color-primary, #667eea) !important;
  font-weight: 600;
}

/* User actions dropdown styling */
.user-actions-trigger {
  background: var(--color-primary-light, #e8f2ff) !important;
  color: var(--color-primary, #667eea) !important;
  border: 1px solid var(--color-primary-light, #e8f2ff) !important;
}

.user-actions-trigger:hover {
  background: var(--color-primary, #667eea) !important;
  color: var(--color-text-light, white) !important;
}

/* Ensure Mantine dropdowns are not cut off */
[data-mantine-component="Menu.Dropdown"] {
  overflow: visible !important;
  z-index: 99999 !important;
}

/* Fix dropdown positioning at specific breakpoints */

.nav-dropdown {
  min-width: 200px;
  max-width: 300px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* Specific styling for account dropdown menu */
.account-dropdown-menu {
  max-height: calc(100vh - 120px) !important;
  overflow-y: auto !important;
}

/* Ensure dropdown content is scrollable if needed */
.account-dropdown-menu .mantine-Menu-itemLabel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.nav-item-active {
  background: var(--color-primary-light) !important;
  color: var(--color-primary) !important;
  font-weight: 600;
}

/* ============================= */
/* Mobile Navigation */
/* ============================= */

.mobile-nav-header {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.mobile-nav-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary, #667eea);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-nav-toggle span {
  width: 24px;
  height: 3px;
  background: var(--color-text-light);
  border-radius: 3px;
  transition: all 0.3s ease;
}

.mobile-nav-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mobile-nav-toggle.active span:first-child {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation Sidebar */
.navigation.mobile-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: clamp(280px, 85vw, 400px);
  max-width: 90vw;
  background: var(--color-bg-primary);
  border-left: 1px solid var(--color-border-light);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}

/* ============================= */
/* Responsive Breakpoints */
/* ============================= */

/* Mobile: <768px */

/* Tablet: 768px - 1023px */


/* Exactly 1024px - very tight spacing */

/* Small Laptop: 1025px - 1200px */

/* Laptop: 1201px - 1439px */

/* Desktop: ≥1440px */

/* Large Desktop: ≥2560px (4K) */

/* Landscape Mobile */

/* High DPI Screens */

/* Print Styles */

/* Accessibility - Focus States */
.nav-dropdown-trigger:focus,
.mobile-nav-toggle:focus,
.back-button:focus {
  outline: 2px solid var(--color-primary, #667eea);
  outline-offset: 2px;
}

/* Reduced Motion */

/* High Contrast Mode */

/* Dark Theme Support */
[data-theme='dark'] .desktop-nav-bar {
  background: var(--color-background-primary, #1a1b1e);
  border-color: var(--color-border, #373a40);
}

[data-theme='dark'] .nav-dropdown-trigger {
  color: var(--color-text-primary, #c1c2c5);
}

[data-theme='dark'] .nav-dropdown-trigger:hover {
  background: var(--color-background-secondary, #25262b);
}

[data-theme='dark'] .navigation {
  background: var(--color-background-primary, #1a1b1e);
  border-color: var(--color-border, #373a40);
}