/* ==========================================
   CRITICAL CSS - Above the fold content
   Prevents flashing and layout shifts
   Extracted from index.html for better organization
   ========================================== */

/* Basic reset and layout */
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #111827;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* Header Top - Critical styles */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(249, 249, 249, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.1);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  margin: 0;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.logo-video {
  height: 60px;
  width: 60px;
  min-width: 60px;
  border-radius: 6px;
  display: block;
  object-fit: cover;
  flex-shrink: 0;
}

.logo-svg {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.menu-top {
  display: flex;
  gap: 14px;
  align-items: center;
}

/* Header Mid - Critical styles */
.header-mid {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  background: transparent;
}

.city-container {
  display: flex;
  align-items: center;
  border-radius: 12px;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  padding: 10px 14px;
  min-width: 240px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  gap: 8px;
}

.city-icon {
  font-size: 20px;
  color: #0077cc;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.city-select {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  padding: 2px 8px;
}

.gps-btn {
  background: linear-gradient(135deg, #00ff7a, #00c95a);
  border: 0;
  cursor: pointer;
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,255,122,0.3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
}

.search-bar-container {
  flex: 1;
  position: relative;
  max-width: calc(100% - 180px);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
}

.search-bar {
  width: 100%;
  padding: 12px 110px 12px 14px;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  background: #ffffff;
  box-sizing: border-box;
}

.search-actions {
  position: absolute !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: flex !important;
  gap: 4px !important;
  align-items: center !important;
  z-index: 10 !important;
  flex-shrink: 0;
  visibility: visible !important;
  opacity: 1 !important;
}

.search-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: none;
  background: transparent;
  color: #64748b !important;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 16px !important;
  padding: 0;
  margin: 0;
  line-height: 1;
  position: relative;
}

.search-btn i,
.search-btn .fas,
.search-btn .fa {
  display: inline-block !important;
  font-size: 16px !important;
  color: inherit !important;
  line-height: 1 !important;
  width: auto !important;
  height: auto !important;
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}

.search-btn:hover {
  background: #f1f5f9;
  color: #1e293b !important;
}

.search-btn:hover i {
  color: #1e293b !important;
}

.search-btn:active {
  transform: scale(0.95);
}

.search-btn label {
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.search-btn label i {
  display: inline-block !important;
  font-size: 16px !important;
  color: inherit !important;
}

/* Ensure search buttons are always visible */
#voice-search-btn,
#text-search-btn,
.search-btn,
.search-btn label {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure search button icons are visible */
.search-btn i,
.search-btn i.fas,
.search-btn i.fa-microphone,
.search-btn i.fa-camera,
.search-btn i.fa-search {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 16px !important;
}

/* Fallback text for icons if Font Awesome fails */
.search-btn::before {
  content: '';
  display: none;
}

/* Ensure icons load properly */
.search-btn i.fas,
.search-btn i.fa-microphone,
.search-btn i.fa-camera,
.search-btn i.fa-search {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "FontAwesome", "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: inline-block !important;
  font-style: normal !important;
  font-variant: normal !important;
  text-rendering: auto !important;
  line-height: 1 !important;
}

/* Fallback: Show emoji if Font Awesome icons don't load */
.search-btn i.fas {
  position: relative;
}

/* Show fallback emoji only if Font Awesome fails (when icon has no content) */
.search-btn i.fas:empty + .icon-fallback,
.search-btn i.fas:not(:has-text) + .icon-fallback {
  display: inline-block !important;
  font-size: 16px !important;
  margin-left: 0;
}

/* Hide fallback when Font Awesome loads successfully */
.search-btn i.fas:not(:empty) + .icon-fallback {
  display: none !important;
}

/* Navigation Bar - Critical styles */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 99;
}

.nav-bar .nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  font-size: 1.2rem;
  font-weight: 550;
  line-height: 1.3;
  color: #1e293b;
  text-decoration: none;
  text-align: center;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.7);
  transition: all 0.3s ease;
}

/* Hide elements that should be hidden initially - prevents flash before JS runs */
#user-menu-btn,
#user-dropdown,
.alert-container,
#top-set-alert,
#top-help,
#theme-toggle,
#city-selection-indicator,
#autocomplete-empty,
#autocomplete-loading,
#city-information-section,
#location-indicator-city,
#location-indicator-hospitals,
#location-indicator-doctors,
#location-indicator-labs,
#location-indicator-pharmacies,
#location-indicator-emergency,
#emergency-near-me-section,
.health-articles[style*="display: none"],
#appointment-modal,
#keyboard-shortcuts-modal,
.dropdown[style*="display: none"],
a[href="id.html"][style*="display: none"],
a[href="cart.html"][style*="display: none"] {
  display: none !important;
}

/* Health tip widget removed from above rule - JavaScript controls its visibility */

/* Hide user dropdown links initially */
#user-dropdown a[href="login.html"],
#user-dropdown a[href="register.html"],
#user-dropdown a[href="dashboard.html"] {
  display: none !important;
}

/* Prevent layout shift for icons */
.icons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icons a img {
  height: 36px;
  width: auto;
  border-radius: 6px;
}

/* Font Awesome icon base styles - prevent layout shift */
.fas, .far, .fab, .fal, .fad {
  display: inline-block;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  line-height: 1;
}

/* Prevent image layout shift - reserve space for images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure logo video doesn't cause layout shift */
.logo-video {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

