/* =====================================================
   APEX HOSPITAL - PREMIUM DESKTOP MEGA MENU
   Desktop-only 3-column landscape layout
   ===================================================== */

/* ── Wrapper on the Services <li> ── */
.apex-mega-wrapper {
  position: static;
}

/* ── Trigger button (Services) ── */
.apex-mega-trigger {
  position: relative;
  cursor: pointer;
  user-select: none;
}

/* ── The mega panel itself ── */
.apex-mega-panel {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  top: auto; /* set via JS after mount */
  width: 95vw;
  max-width: 1000px; /* narrowed slightly for 3 cols */
  background: #ffffff;
  border-radius: 18px;
  box-shadow:
    0 4px 6px -1px rgba(0,0,0,0.07),
    0 10px 40px -4px rgba(0,0,0,0.13),
    0 0 0 1px rgba(226,232,240,0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s cubic-bezier(0.4,0,0.2,1),
    transform 0.22s cubic-bezier(0.4,0,0.2,1),
    visibility 0s linear 0.22s;
  z-index: 99999;
  overflow: visible; /* changed from hidden to allow inner menus */
}

.apex-mega-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition:
    opacity 0.22s cubic-bezier(0.4,0,0.2,1),
    transform 0.22s cubic-bezier(0.4,0,0.2,1),
    visibility 0s linear 0s;
}

/* ── Inner grid: 3 columns ── */
.apex-mega-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 0;
  min-height: 420px;
}

/* ── Shared column styles ── */
.apex-mega-col {
  padding: 24px 20px;
  border-right: 1px solid #f1f5f9;
}
.apex-mega-col:last-child {
  border-right: none;
}

/* ── Column headings ── */
.apex-col-heading {
  font-family: 'Inter', 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 7px;
}
.apex-col-heading i {
  font-size: 13px;
}

/* ── Menu item link ── */
.apex-mega-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #374151;
  font-family: 'Inter', 'Poppins', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  margin-bottom: 2px;
  position: relative; /* For inner menus */
}
.apex-mega-item:hover {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
  color: #1d4ed8;
  transform: translateX(3px);
}
.apex-mega-item.has-inner-open {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
  color: #1d4ed8;
}

/* ── Inner Submenu Fixes ── */
.apex-inner-sub {
  position: absolute;
  left: 100%;
  top: -10px;
  min-width: 260px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: all 0.2s ease;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.apex-mega-item:hover > .apex-inner-sub,
.apex-has-inner:hover > .apex-inner-sub,
.apex-inner-sub:hover {
  opacity: 1;
  visibility: visible;
  transform: translateX(10px);
}
.apex-inner-sub a, .apex-inner-sub .apex-has-inner {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: #475569;
  text-decoration: none;
  font-size: 12.5px;
  border-radius: 8px;
  transition: all 0.15s ease;
  cursor: pointer;
}
.apex-inner-sub a:hover, .apex-inner-sub .apex-has-inner:hover {
  background: #f8fafc;
  color: #1d4ed8;
  transform: translateX(3px);
}
.apex-inner-sub a i, .apex-inner-sub .apex-has-inner > i {
  margin-right: 8px;
  font-size: 12px;
  width: 16px;
  text-align: center;
}
.apex-inner-sub .apex-has-inner {
  position: relative;
  justify-content: space-between;
}
.apex-inner-sub .apex-inner-sub {
  top: -10px;
  left: 100%;
  transform: translateX(-10px);
}
.apex-inner-sub .apex-has-inner:hover > .apex-inner-sub {
  opacity: 1;
  visibility: visible;
  transform: translateX(10px);
}

.apex-mega-item.apex-has-inner:hover {
  z-index: 200;
}

/* ── Item icon circle ── */
.apex-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.apex-mega-item:hover .apex-item-icon {
  transform: scale(1.1);
}

/* Col 1: Departments */
.apex-col-dept .apex-item-icon { background: #fef3f2; color: #ef4444; }
.apex-col-dept .apex-mega-item:hover { background: #fef3f2; color: #dc2626; }
.apex-col-dept .apex-inner-sub a:hover i { color: #ef4444; }

/* Col 2: Facilities */
.apex-col-fac .apex-item-icon { background: #f0fdf4; color: #16a34a; }
.apex-col-fac .apex-mega-item:hover { background: #f0fdf4; color: #15803d; }
.apex-col-fac .apex-inner-sub a:hover i { color: #16a34a; }

/* ── Item arrow ── */
.apex-mega-item .apex-arrow {
  margin-left: auto;
  font-size: 10px;
  color: #cbd5e1;
  transition: color 0.15s ease, transform 0.15s ease;
}
.apex-mega-item:hover .apex-arrow {
  color: #1d4ed8;
  transform: translateX(2px);
}
.apex-has-inner .apex-arrow {
  color: #cbd5e1;
}

/* ── Item description text ── */
.apex-item-desc {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
  display: block;
  line-height: 1.3;
}

/* ── Col 3: Premium Appointment & App Download ── */
.apex-col-appt {
  background: #f8fafc;
  border-radius: 0 18px 18px 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-left: 1px solid #f1f5f9;
}

/* Premium Appointment Card */
.apex-premium-card {
  position: relative;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border-radius: 14px;
  padding: 20px;
  color: white;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
}
.apex-card-bg-shape {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}
.apex-card-content {
  position: relative;
  z-index: 2;
}
.apex-card-content h4 {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.apex-card-content h4 i {
  color: #93c5fd;
}
.apex-card-content p {
  margin: 0 0 16px 0;
  font-size: 11.5px;
  color: #bfdbfe;
  line-height: 1.4;
}
.apex-btn-book-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: white;
  color: #1d4ed8;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  width: 100%;
}
.apex-btn-book-new:hover {
  background: #f0f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Premium Emergency Box */
.apex-emergency-box-new {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border: 1px solid #fee2e2;
  border-radius: 12px;
  padding: 12px 16px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.05);
}
.apex-emergency-box-new:hover {
  border-color: #fca5a5;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.15);
}
.apex-emg-icon-new {
  width: 40px;
  height: 40px;
  background: #fef2f2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  font-size: 16px;
}
.apex-pulse-icon {
  animation: apexPulse 2s infinite;
}
@keyframes apexPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}
.apex-emg-info {
  display: flex;
  flex-direction: column;
}
.apex-emg-label-new {
  font-size: 10.5px;
  color: #ef4444;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.apex-emg-number-new {
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.5px;
}

/* Address Box */
.apex-address-box-new {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 8px;
}
.apex-address-box-new i {
  color: #64748b;
  margin-top: 3px;
}
.apex-address-box-new p {
  margin: 0;
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.5;
}
.apex-address-box-new p strong {
  color: #334155;
  display: block;
}

/* Play Store Button */
.apex-playstore-btn {
  display: flex;
  align-items: center;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  gap: 12px;
  transition: all 0.2s ease;
  width: max-content;
}
.apex-playstore-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  background: #111;
}
.apex-playstore-btn .play-logo i {
  background: -webkit-linear-gradient(45deg, #00c3ff, #00ff55, #ffdd00, #ff0055);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 26px;
}
.apex-playstore-btn .play-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.apex-playstore-btn .play-small {
  font-size: 9px;
  line-height: 1;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.apex-playstore-btn .play-large {
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  font-family: 'Product Sans', 'Inter', sans-serif;
  letter-spacing: -0.2px;
  color: #fff;
}

/* ── Top accent bar ── */
.apex-mega-panel::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #e53e3e 0%, #f97316 30%, #eab308 60%, #22c55e 80%, #3b82f6 100%);
  border-radius: 18px 18px 0 0;
}

/* ── Arrow notch pointing up ── */
.apex-mega-notch {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 7px;
  overflow: hidden;
}
.apex-mega-notch::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  background: #e53e3e;
  transform: rotate(45deg) translateY(7px);
  border-radius: 2px;
}

/* ── Overlay backdrop (blur background) ── */
.apex-mega-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99990; /* behind the header */
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  pointer-events: none; /* Crucial: stops flickering by not blocking mouse events */
  transition: opacity 0.3s ease;
  opacity: 0;
}
.apex-mega-backdrop.is-open {
  display: block;
  opacity: 1;
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Only show on desktop (≥1280px)
   ═══════════════════════════════════════════ */
@media (max-width: 1279px) {
  .apex-mega-panel,
  .apex-mega-backdrop {
    display: none !important;
  }
}

/* Slight viewport correction so panel never goes off-screen */
@media (min-width: 1280px) {
  .apex-mega-panel {
    max-width: min(1000px, 95vw);
  }
}

/* Smooth icon pulse on open */
@keyframes apexMenuIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.apex-mega-panel.is-open {
  animation: apexMenuIn 0.22s cubic-bezier(0.4,0,0.2,1) both;
}
