/* ── Global WhatsApp Floating Button SVG Explosion Protection ── */
a.wa-float, .wa-float {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 9999 !important;
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  background: #25D366 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

a.wa-float:hover, .wa-float:hover {
  transform: scale(1.1) !important;
  box-shadow: 0 6px 28px rgba(37, 211, 102, 0.6) !important;
}

a.wa-float svg, .wa-float svg {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  fill: #FFFFFF !important;
  color: #FFFFFF !important;
  display: block !important;
  margin: 0 auto !important;
  flex-shrink: 0 !important;
}

@media (max-width: 768px) {
  a.wa-float, .wa-float {
    bottom: 16px !important;
    right: 16px !important;
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
  }
  a.wa-float svg, .wa-float svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
  }
}

/* ── Playful 3D Curriculum Cards & Perspective Tilt ── */
#skills-section {
  perspective: 1000px;
}

.skills-marquee-container {
  transform-style: preserve-3d;
}

.logo-card {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 16px !important;
  padding: 10px 20px !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02) !important;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, border-color 0.3s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
}

.logo-card:hover {
  transform: translateY(-8px) rotateX(6deg) rotateY(-3deg) scale(1.05) !important;
  box-shadow: 0 20px 35px -8px rgba(244, 96, 12, 0.2), 0 8px 16px -4px rgba(0, 0, 0, 0.06) !important;
  border-color: #F4600C !important;
}

.logo-card i {
  transition: transform 0.3s ease !important;
}

.logo-card:hover i {
  transform: scale(1.2) rotate(6deg) !important;
}

/* ═══════════════════════════════════════════════════════════════
   STEMULUS GLOBAL RESPONSIVENESS & WIDGET COORDINATOR
   Guarantees 100% Touch Target Compliance & Zero Widget Collisions
   ═══════════════════════════════════════════════════════════════ */

/* ── Global Brand Logo Display Fix ── */
.nav-logo-editorial,
.nav-logo,
.portal-brand-logo {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.65rem !important;
  text-decoration: none !important;
  background: transparent !important;
}

img[src*="logo.png"],
img[src*="logo"],
.nav-logo-editorial img,
.nav-logo img,
.portal-brand-logo img,
header img[src*="logo"],
footer img[src*="logo"],
aside img[src*="logo"] {
  height: 36px !important;
  width: 36px !important;
  max-width: 36px !important;
  object-fit: contain !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  filter: none !important;
  -webkit-filter: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  display: inline-block !important;
}

.nav-logo-editorial span,
.nav-logo span,
.portal-brand-logo span {
  font-family: 'Nunito', sans-serif !important;
  font-weight: 900 !important;
  font-size: 1.35rem !important;
  color: #0F172A !important;
  letter-spacing: -0.02em !important;
  line-height: 1 !important;
}

/* ── 1. Floating Widget Coordinator (< 640px Mobile Viewports) ── */
@media (max-width: 640px) {
  /* Pill Toolbar: Pinned center bottom */
  .pill-toolbar {
    position: fixed !important;
    bottom: 12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 100 !important;
    padding: 0.35rem 0.85rem !important;
    background: #ffffff !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  }

  .toolbar-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /* Mulu Mascot Widget: Shifted above pill toolbar on bottom-right */
  #mulu-widget,
  .mulu-floating-widget {
    bottom: 75px !important;
    right: 12px !important;
    left: auto !important;
    z-index: 95 !important;
  }

  .mulu-body {
    width: 70px !important;
    height: 70px !important;
  }

  .mulu-speech-bubble,
  .mulu-bubble {
    max-width: 210px !important;
    font-size: 11px !important;
    padding: 8px 12px !important;
  }

  /* WhatsApp Float Button: Shifted to bottom-left to avoid Mulu & Toolbar */
  .whatsapp-float,
  #whatsapp-widget {
    left: 16px !important;
    right: auto !important;
    bottom: 16px !important;
    width: 50px !important;
    height: 50px !important;
    z-index: 90 !important;
  }

  .whatsapp-float svg {
    width: 26px !important;
    height: 26px !important;
  }
}

/* ── 2. Universal Touch Target Compliance (Minimum 44px) ── */
@media (max-width: 768px) {
  button:not(.btn-icon-only),
  a.btn-3d,
  a.action-btn-item,
  .toolbar-btn,
  .roadmap-filter-btn,
  .mulu-btn,
  .star-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="select"],
  select {
    font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
    min-height: 44px;
  }
}

/* ── 3. Table Responsive Scrolling & Sticky Freeze ── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .table-responsive table {
    min-width: 600px;
  }
}

/* ── 4. Modal Overflow & Height Safety ── */
.modal-content,
#qrcode-modal .glass-card,
#tutor-report-modal > div,
#parent-reschedule-modal > div,
#parent-cert-modal > div {
  max-height: 85vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* ── 5. Admin & Tutor Drawer Overlay Utilities ── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ================================================================
   PORTAL MOBILE-FIRST RESPONSIVE — All Portals
   ================================================================ */

/* Sidebar: force off-screen on mobile for all portals */
@media (max-width: 1023px) {
  #sidebar, aside#sidebar {
    transform: translateX(-100%) !important;
    position: fixed !important;
    width: 256px !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 50 !important;
  }
  #sidebar.open, aside#sidebar.open {
    transform: translateX(0) !important;
  }
  .lg\:ml-64, [class*="lg:ml-64"] {
    margin-left: 0 !important;
  }
}
@media (min-width: 1024px) {
  #sidebar, aside#sidebar {
    transform: translateX(0) !important;
    visibility: visible !important;
  }
}

/* Portal tables: horizontal scroll on mobile */
@media (max-width: 768px) {
  .overflow-x-auto { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  table { font-size: 0.8rem; }
  table th, table td { padding: 8px 10px !important; white-space: nowrap; }
  .glass-card, .dash-card { padding: 1rem !important; }
}

/* Portal grid stacking on mobile */
@media (max-width: 640px) {
  .grid-cols-4, [class*="grid-cols-4"] { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-cols-3, [class*="grid-cols-3"] { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 400px) {
  .grid-cols-4, [class*="grid-cols-4"],
  .grid-cols-3, [class*="grid-cols-3"],
  .grid-cols-2, [class*="grid-cols-2"] { grid-template-columns: 1fr !important; }
}

/* Form grids inside modals: single column on mobile */
@media (max-width: 640px) {
  .qb-form-grid { grid-template-columns: 1fr !important; }
  .form-grid-2, [class*="grid-cols-2"]:not(.qb-pref-row) { grid-template-columns: 1fr !important; }
}

/* Modal full-width on phones */
@media (max-width: 600px) {
  [class*="max-w-md"], [class*="max-w-lg"], [class*="max-w-xl"] {
    max-width: 95vw !important;
    margin: 0.75rem auto !important;
  }
  [class*="rounded-none"] { border-radius: 12px !important; }
}

/* Touch targets: minimum 44px */
@media (max-width: 768px) {
  .nav-link, .btn-3d, [class*="btn-"], button[type="submit"] {
    min-height: 44px !important;
  }
}

/* Admin nav inner on mobile */
@media (max-width: 640px) {
  [class*="nav-inner"] { padding: 0.5rem 0.75rem !important; }
}

/* Email queue action buttons: stack on small screens */
@media (max-width: 500px) {
  .flex.items-start.justify-between { flex-direction: column !important; gap: 0.75rem !important; }
  .flex.items-start.justify-between > .flex { flex-wrap: wrap !important; }
}

/* Safe-area padding for iOS bottom bar */
.pill-toolbar, [id*="mobile-booking-bar"] {
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0)) !important;
}
