/**
 * TeleWorld Header Styles
 * Extracted from header.php inline <style> block.
 * Enqueued via functions.php teleworld_enqueue_scripts().
 */

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 1;
  visibility: visible;
  transition: all 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-spinner {
  text-align: center;
  color: #8b5cf6;
  width: 50px;
  height: 50px;
  border: 4px solid rgba(139, 92, 246, 0.2);
  border-top: 4px solid #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(139, 92, 246, 0.2);
  border-top: 4px solid #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Mobile menu hardening against cross-file CSS conflicts */
@media (max-width: 900px) {
  .mobile-menu-toggle .sr-only {
    display: none !important;
  }

  .mobile-menu-toggle {
    overflow: hidden !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    letter-spacing: -9999px !important;
  }

  .mobile-menu-toggle::before,
  .mobile-menu-toggle::after {
    content: none !important;
    display: none !important;
  }

  .mobile-menu-toggle .hamburger-line {
    display: block !important;
    flex: 0 0 auto !important;
    text-indent: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .mobile-menu-close {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: rgba(139, 92, 246, 0.1) !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    width: 40px;
    height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    color: #8b5cf6 !important;
    font-size: 2rem !important;
    line-height: 1 !important;
    flex-shrink: 0;
  }

  .mobile-navigation .mobile-nav-menu a {
    display: block !important;
    width: 100%;
  }
}
/* E1: Offset for fixed header so page content is not hidden underneath */
body {
  padding-top: var(--header-height, 80px);
}

body.admin-bar {
  padding-top: calc(var(--header-height, 80px) + 32px); /* header + admin bar */
}

@media screen and (max-width: 782px) {
  body.admin-bar {
    padding-top: calc(
      var(--header-height, 80px) + 46px
    ); /* header + 46px admin bar */
  }
}

/* Enhanced Header Styles */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  z-index: 9999;
  transition: all 0.3s ease;
  padding: 0.75rem 0;
}

.site-header.scrolled {
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  padding: 0.5rem 0;
}

/* Admin Bar Adjustments - Fix for error messages appearing behind header */
body.admin-bar .site-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .site-header {
    top: 46px;
  }
}

/* Ensure WordPress admin bar stays above header */
#wpadminbar {
  z-index: 99999 !important;
}

/* Fix admin notices and error messages appearing behind header */
.notice,
.error,
.updated,
.wrap > .notice {
  position: relative !important;
  z-index: 10001 !important;
  margin-top: 100px !important;
  clear: both !important;
}

/* Fix for frontend admin notices */
body:not(.wp-admin) .notice,
body:not(.wp-admin) .error,
body:not(.wp-admin) .updated {
  position: fixed !important;
  top: 100px !important;
  left: 20px !important;
  right: 20px !important;
  z-index: 10001 !important;
  margin: 0 !important;
  max-width: calc(100% - 40px) !important;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.site-branding {
  flex-shrink: 0;
}

#site-navigation {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: space-between;
  gap: 1rem;
}

.main-navigation .nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-navigation .header-cta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Enhanced Logo */
.site-logo a {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.logo-text {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #8b5cf6 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.logo-tagline {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 0.2rem;
  letter-spacing: 0.5px;
}

.site-logo img {
  max-height: 45px;
  width: auto;
  transition: all 0.3s ease;
}

.site-header.scrolled .site-logo img {
  max-height: 35px;
}

/* Enhanced Navigation */
.main-navigation {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 1 1 auto;
  min-width: 0;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
}

.nav-menu li {
  position: relative;
}

.nav-menu a {
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  display: block;
}

.nav-menu a:hover,
.nav-menu .current-menu-item a {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.nav-menu a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-menu a:hover::after,
.nav-menu .current-menu-item a::after {
  width: 80%;
}

/* Header CTA Buttons */
.header-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.header-cta .btn-outline-small,
.header-cta .cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* User Menu Styles */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  /* Ensure dropdown is never clipped */
  overflow: visible;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.user-info:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
}

.user-avatar {
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.2);
  border-radius: 50%;
  color: #8b5cf6;
}

.user-name {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.9rem;
}

.user-role {
  font-size: 0.75rem;
  color: #94a3b8;
  background: rgba(139, 92, 246, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
  z-index: 10000;
  padding: 0.5rem 0;
  white-space: nowrap;
}

/* B7: Hover-open only on true-pointer devices (desktop). Resolves via .open class on touch. */
@media (hover: hover) and (pointer: fine) {
  .user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  /* Keep JS .open class working alongside hover */
  .user-menu:not(:hover) .user-dropdown:not(.open) {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border-radius: 0;
}

.dropdown-item:hover {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.dropdown-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.dropdown-divider {
  height: 1px;
  background: rgba(139, 92, 246, 0.2);
  margin: 0.5rem 0;
}

.logout-item {
  color: #ef4444;
}

.logout-item:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

/* Mobile User Menu */
.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.mobile-user-avatar {
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.2);
  border-radius: 50%;
  color: #8b5cf6;
}

.mobile-user-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-user-name {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 1rem;
}

.mobile-user-role {
  font-size: 0.8rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-logout {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
}

.btn-logout:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-outline-small {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #8b5cf6;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  background: rgba(139, 92, 246, 0.06);
}

.btn-outline-small:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: #8b5cf6;
  color: #a855f7;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
  color: white;
}

.cta-icon {
  font-size: 1rem;
}

/* Mobile Menu Enhanced */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  z-index: 10001;
  position: relative;
  transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
}

.hamburger-line {
  width: 22px;
  height: 2px;
  background: #8b5cf6;
  margin: 2px 0;
  transition: 0.3s;
  border-radius: 2px;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* Enhanced Mobile Navigation — hidden on ALL viewports; JS adds .active only on mobile */
.mobile-navigation {
  display: none; /* base: always hidden */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 10003; /* Above header (9999) and hamburger (10001) */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

/* Only show when .active on mobile/small-tablet (≤900px) — NO display:block in hidden state */
@media (max-width: 900px) {
  .mobile-navigation.active {
    display: block;
    opacity: 1;
    visibility: visible;
  }
}

.mobile-menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  padding: 0;
  padding-top: 0; /* Logo + close in mobile-menu-header handle spacing */
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  border-left: 1px solid rgba(139, 92, 246, 0.2);
  z-index: 10004; /* Above overlay */
}

.mobile-navigation.active .mobile-menu-content {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  background: rgba(139, 92, 246, 0.1);
  min-height: 66px; /* Match header height */
}

.mobile-logo .logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mobile-menu-close {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  color: #8b5cf6;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-menu-close:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
  color: #a855f7;
}

/* Mobile menu logo — use SVG image */
.mobile-menu-logo.teleworld-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.mobile-menu-logo-img {
  height: 42px;
  width: auto;
}

.mobile-nav-menu {
  list-style: none;
  padding: 1.5rem 0;
  margin: 0;
}

.mobile-nav-menu li {
  margin: 0;
}

.mobile-nav-menu a {
  display: block;
  color: #e2e8f0;
  font-size: 1rem;
  font-weight: 500;
  padding: 1rem 1.5rem;
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.mobile-nav-menu a:hover,
.mobile-nav-menu .current-menu-item a {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  border-left-color: #8b5cf6;
}

/* B9: Mobile submenu accordion (toggled by .submenu-toggle button injected via navigation.js) */
.mobile-nav-menu .menu-item-has-children {
  position: relative;
}

.mobile-nav-menu .menu-item-has-children > a {
  padding-right: 3rem; /* make room for toggle button */
}

.submenu-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 3rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #8b5cf6;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.25s ease;
  z-index: 1;
}

.mobile-nav-menu .menu-item-has-children.open > .submenu-toggle {
  transform: rotate(180deg);
}

.mobile-nav-menu .sub-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  background: rgba(139, 92, 246, 0.06);
  border-left: 2px solid rgba(139, 92, 246, 0.4);
}

.mobile-nav-menu .menu-item-has-children.open > .sub-menu {
  display: block;
}

.mobile-nav-menu .sub-menu a {
  padding: 0.75rem 1.5rem 0.75rem 2rem;
  font-size: 0.9rem;
  color: #cbd5e1;
  border-left: none;
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.mobile-nav-menu .sub-menu a:hover {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

.mobile-cta {
  padding: 1.5rem;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-btn {
  display: block;
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.mobile-social {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-link:hover {
  background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
  color: white;
  transform: translateY(-2px);
}

/* .sr-only / .screen-reader-text — defined in accessibility.css */

/* Dropdown open state via JS class (avoids inline-style / hover conflict) */
.user-dropdown.open {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DESKTOP SUBMENU DROPDOWNS
   ═══════════════════════════════════════════════════════════════════════════ */

.nav-menu .menu-item-has-children {
  position: relative;
}

.nav-menu .menu-item-has-children > a::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 6px;
  vertical-align: middle;
  transition: transform 0.25s ease;
}

.nav-menu .sub-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
  z-index: 10000;
}

.nav-menu .sub-menu li {
  margin: 0;
}

.nav-menu .sub-menu a {
  display: block;
  padding: 0.65rem 1.2rem;
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 0;
}

.nav-menu .sub-menu a::after {
  display: none; /* hide parent underline effect */
}

.nav-menu .sub-menu a:hover {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

/* Hover-open submenus only on devices with fine pointer (desktop) */
@media (hover: hover) and (pointer: fine) {
  .nav-menu .menu-item-has-children:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-menu .menu-item-has-children:hover > a::before {
    transform: rotate(180deg);
  }
}

/* Keyboard :focus-within — opens submenu when any child receives focus (WCAG) */
.nav-menu .menu-item-has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu .menu-item-has-children:focus-within > a::before {
  transform: rotate(180deg);
}

/* Focus-visible outline for submenu links */
.nav-menu .sub-menu a:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: -2px;
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CART / SHOPPING ICON — responsive
   ═══════════════════════════════════════════════════════════════════════════ */

.header-cart {
  position: relative;
  display: flex;
  align-items: center;
}

.cart-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  text-decoration: none;
  color: #e2e8f0;
  font-size: 1.15rem;
  transition: all 0.3s ease;
  position: relative;
}

.cart-link:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SAFE AREA INSETS — notched / curved-screen devices (iPhone X+, etc.)
   ═══════════════════════════════════════════════════════════════════════════ */

@supports (padding: env(safe-area-inset-top)) {
  .site-header {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  body {
    padding-top: calc(var(--header-height, 80px) + env(safe-area-inset-top));
  }

  body.admin-bar {
    padding-top: calc(
      var(--header-height, 80px) + 32px + env(safe-area-inset-top)
    );
  }

  body.admin-bar .site-header {
    top: calc(32px + env(safe-area-inset-top));
  }

  .mobile-menu-content {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-social {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Large Desktop (1025px+) — defaults above ────────────────────────── */

/* ── Tablet landscape / small desktop (≤ 1024px) ─────────────────────── */
@media (max-width: 1024px) {
  body {
    padding-top: var(--header-height, 72px);
  }

  body.admin-bar {
    padding-top: calc(var(--header-height, 72px) + 32px);
  }

  .site-header {
    padding: 0.6rem 0;
  }

  .main-navigation {
    gap: 1rem;
  }

  .nav-menu {
    gap: 0.25rem;
  }

  .nav-menu a {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .header-cta {
    gap: 0.75rem;
  }

  .user-info {
    padding: 0.4rem 0.8rem;
  }

  .user-name {
    font-size: 0.85rem;
  }

  .user-role {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
  }

  /* Disable hover transforms on touch-capable devices */
  .cta-button:hover,
  .social-link:hover,
  .btn-logout:hover {
    transform: none;
  }
}

/* ── Tablet: 901-1024px — shrink CTA, hide user text ─────────────────── */
@media (min-width: 901px) and (max-width: 1024px) {
  .user-name,
  .user-role {
    display: none;
  }

  .btn-outline-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .cta-button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  .cart-link {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* ── Mobile / small tablet (≤ 900px) — switch to hamburger menu ───────── */
@media (max-width: 900px) {
  /* Body padding 0 so hero backgrounds bleed behind the translucent header */
  body {
    padding-top: 0 !important;
  }

  /* Push first page content below the fixed header */
  .site-main > .section:first-child,
  .site-main > .hero-section {
    padding-top: 130px !important;
  }

  .page-header {
    padding-top: 130px !important;
  }

  body.admin-bar {
    padding-top: 102px !important; /* 70px nav + 32px admin-bar */
  }

  .main-navigation,
  .header-cta {
    display: none !important;
  }

  /* Show logo on mobile — smaller size */
  .site-branding {
    display: block !important;
    flex-shrink: 0 !important;
  }

  .site-branding .teleworld-logo {
    transform: scale(0.8);
    transform-origin: left center;
  }

  .header-content {
    justify-content: space-between !important;
    gap: 0.5rem !important;
    padding: 0 0.75rem !important;
  }

  /* Hamburger toggle — bulletproof: no text, only lines */
  .mobile-menu-toggle {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(139, 92, 246, 0.1) !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-left: 0 !important;
    flex-shrink: 0 !important;
    z-index: 10001 !important;
    position: relative !important;
    overflow: hidden !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    letter-spacing: -9999px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
  }

  .mobile-menu-toggle * {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
  }

  .mobile-menu-toggle::before,
  .mobile-menu-toggle::after {
    content: none !important;
    display: none !important;
  }

  .mobile-menu-toggle .hamburger-line {
    display: block !important;
    width: 22px !important;
    height: 2px !important;
    margin: 2px 0 !important;
    background: #8b5cf6 !important;
    border-radius: 2px !important;
    flex: 0 0 auto !important;
    text-indent: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .site-header {
    padding: 0.5rem 0;
  }

  .site-logo img {
    max-height: 38px;
  }

  .logo-text {
    font-size: 1.5rem;
  }

  .logo-tagline {
    font-size: 0.7rem;
  }

  .mobile-menu-content {
    width: 320px;
  }

  /* Hide user menu on mobile/tablet - it's handled in mobile navigation */
  .user-menu {
    display: none;
  }

  /* Desktop submenus hidden at mobile — accordion replaces them */
  .nav-menu .sub-menu {
    display: none !important;
  }

  /* Ensure touch targets are at least 44×44px (WCAG 2.5.5) */
  .mobile-nav-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .submenu-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  .mobile-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .social-link {
    width: 44px;
    height: 44px;
  }

  /* Prevent body scroll when mobile menu is open (iOS fix) */
  body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
}

/* WP admin bar collapses to 46px at ≤782px — override body offset */
@media screen and (max-width: 782px) {
  body.admin-bar {
    padding-top: 116px !important; /* 70px nav + 46px admin-bar */
  }
}

/* ── Medium mobile (≤ 768px) ──────────────────────────────────────────── */
@media (max-width: 768px) {
  body {
    padding-top: var(--header-height, 62px);
  }

  body.admin-bar {
    padding-top: calc(var(--header-height, 62px) + 46px);
  }

  .site-header {
    padding: 0.45rem 0;
  }

  .header-content {
    gap: 1rem;
    padding: 0 0.75rem;
  }

  .site-logo img {
    max-height: 34px;
  }

  .logo-text {
    font-size: 1.4rem;
  }

  .logo-tagline {
    font-size: 0.65rem;
  }

  .mobile-menu-content {
    width: 85vw;
    max-width: 360px;
  }

  .mobile-nav-menu a {
    padding: 0.9rem 1.25rem;
    font-size: 0.95rem;
  }

  .mobile-cta {
    padding: 1.25rem;
    gap: 0.85rem;
  }

  .mobile-user-info {
    padding: 0.85rem 1.25rem;
  }

  .mobile-user-avatar {
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }

  .mobile-user-name {
    font-size: 0.95rem;
  }

  .mobile-menu-header {
    padding: 1.25rem;
  }

  .mobile-social {
    gap: 0.85rem;
  }
}

/* ── Small mobile (≤ 480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {
  body {
    padding-top: var(--header-height, 58px);
  }

  body.admin-bar {
    padding-top: calc(var(--header-height, 58px) + 46px);
  }

  .site-header {
    padding: 0.35rem 0;
  }

  .header-content {
    gap: 0.75rem;
    padding: 0 0.5rem;
  }

  .site-logo img {
    max-height: 30px;
  }

  .logo-text {
    font-size: 1.2rem;
  }

  .logo-tagline {
    display: none;
  }

  .mobile-menu-toggle {
    width: 44px;
    height: 44px;
  }

  .hamburger-line {
    width: 18px;
  }

  .mobile-menu-content {
    width: 100%;
    max-width: 100%;
  }

  .mobile-menu-header {
    padding: 1rem;
  }

  .mobile-nav-menu a {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
  }

  .mobile-cta {
    padding: 1rem;
    gap: 0.75rem;
  }

  .mobile-user-info {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .mobile-user-avatar {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .mobile-user-name {
    font-size: 0.9rem;
  }

  .mobile-user-role {
    font-size: 0.7rem;
  }

  .mobile-btn {
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
  }

  .mobile-social {
    padding: 0.85rem 1rem;
    gap: 0.75rem;
  }

  .social-link {
    width: 44px;
    height: 44px;
  }

  .mobile-nav-menu .sub-menu a {
    padding: 0.7rem 1rem 0.7rem 1.75rem;
    font-size: 0.85rem;
  }
}

/* ── Extra small mobile (≤ 360px) ─────────────────────────────────────── */
@media (max-width: 360px) {
  body {
    padding-top: var(--header-height, 54px);
  }

  .site-header {
    padding: 0.3rem 0;
  }

  .header-content {
    gap: 0.5rem;
    padding: 0 0.35rem;
  }

  .site-logo img {
    max-height: 26px;
  }

  .logo-text {
    font-size: 1.05rem;
  }

  .mobile-menu-toggle {
    width: 44px;
    height: 44px;
  }

  .hamburger-line {
    width: 16px;
  }

  .mobile-nav-menu a {
    padding: 0.8rem 0.85rem;
    font-size: 0.85rem;
  }

  .mobile-cta {
    padding: 0.85rem;
  }

  .mobile-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LANDSCAPE ORIENTATION — reduce header footprint
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding-top: var(--header-height, 52px);
  }

  body.admin-bar {
    padding-top: calc(var(--header-height, 52px) + 32px);
  }

  .site-header {
    padding: 0.25rem 0;
  }

  .site-logo img {
    max-height: 28px;
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .mobile-menu-content {
    width: 55vw;
    max-width: 320px;
  }

  .mobile-nav-menu a {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    min-height: 38px;
  }

  .mobile-cta {
    padding: 0.75rem 1.25rem;
    gap: 0.5rem;
  }

  .mobile-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    min-height: 38px;
  }

  .mobile-user-info {
    padding: 0.6rem 1rem;
  }

  .mobile-user-avatar {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .mobile-menu-header {
    padding: 0.75rem 1.25rem;
  }

  .mobile-social {
    padding: 0.5rem 1rem;
    gap: 0.75rem;
  }

  .social-link {
    width: 44px;
    height: 44px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE FOOTER RESPONSIVE STYLES
   (merged from mobile-responsive.css)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Footer: phones + small tablets (≤ 900px) ─────────────────────────── */
@media (max-width: 900px) {
  .site-footer {
    padding: 30px 0 20px !important;
  }

  .footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 0 1rem;
  }

  .footer-section {
    margin-bottom: 0;
  }

  .footer-section.company-info {
    order: 1;
  }

  .footer-section.quick-links {
    order: 2;
  }

  .footer-section.services-col {
    order: 3;
  }

  .footer-section.contact-info {
    order: 4;
  }

  .footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .footer-logo .logo-icon {
    font-size: 1.4rem;
  }

  .footer-logo .logo-text {
    font-size: 1.5rem;
  }

  .footer-logo .logo-tagline {
    font-size: 0.8rem;
    display: block;
  }

  .company-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #94a3b8;
    margin-bottom: 1.5rem;
  }

  .social-links {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.3s ease;
  }

  .social-link:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
  }

  .footer-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #e2e8f0;
    font-weight: 600;
  }

  .footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .footer-links li {
    margin-bottom: 0.75rem;
  }

  .footer-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: block;
    padding: 0.5rem 0;
    border-radius: 6px;
  }

  .footer-links a:hover {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    padding-left: 0.75rem;
    transform: translateX(5px);
  }

  .contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
  }

  .contact-item:hover {
    background: rgba(139, 92, 246, 0.1);
    transform: translateX(5px);
  }

  .contact-icon {
    font-size: 1.1rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .contact-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    flex: 1;
  }

  .contact-link:hover {
    color: #8b5cf6;
  }

  .footer-bottom {
    padding: 20px 0 !important;
    margin-top: 2rem;
  }

  .footer-bottom-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    padding: 0 1rem;
  }

  .footer-legal {
    order: 2;
  }

  .footer-certifications {
    order: 1;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .cert-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: #94a3b8;
  }

  .cert-icon {
    font-size: 1rem;
  }

  .copyright {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1rem;
  }

  .legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  .legal-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
  }

  .legal-links a:hover {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
  }
}

/* ── Footer: small phones (≤ 480px) ───────────────────────────────────── */
@media (max-width: 480px) {
  .site-footer {
    padding: 25px 0 15px !important;
  }

  .footer-grid {
    gap: 1.5rem;
    padding: 0 0.75rem;
  }

  .footer-section {
    margin-bottom: 1rem;
  }

  .footer-logo .logo-text {
    font-size: 1.3rem;
  }

  .footer-logo .logo-tagline {
    font-size: 0.75rem;
  }

  .company-description {
    font-size: 0.85rem;
  }

  .social-links {
    gap: 0.75rem;
  }

  .social-link {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .footer-title {
    font-size: 1rem;
  }

  .footer-links a {
    font-size: 0.85rem;
  }

  .contact-item {
    padding: 0.6rem;
    gap: 0.6rem;
  }

  .contact-icon {
    font-size: 1rem;
    width: 22px;
    height: 22px;
  }

  .contact-link {
    font-size: 0.85rem;
  }

  .footer-certifications {
    gap: 0.75rem;
  }

  .cert-item {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }

  .legal-links {
    gap: 0.75rem;
  }

  .legal-links a {
    font-size: 0.75rem;
  }
}

/* ── Footer: tablet (901–1024px) ──────────────────────────────────────── */
@media (min-width: 901px) and (max-width: 1024px) {
  .footer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    padding: 0 1.5rem;
  }

  .footer-section.company-info {
    grid-column: 1 / -1;
    text-align: center;
  }

  .footer-section.contact-info {
    grid-column: 1 / -1;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════════════ */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .mobile-navigation,
  .mobile-menu-content,
  .hamburger-line,
  .cta-button,
  .social-link,
  .user-dropdown,
  .nav-menu .sub-menu,
  .nav-menu a::after,
  .cart-link {
    transition: none !important;
  }

  .spinner {
    animation: none;
  }
}

/* Focus States (WCAG 2.4.7) */
.nav-menu a:focus-visible,
.cta-button:focus-visible,
.mobile-menu-toggle:focus-visible,
.mobile-nav-menu a:focus-visible,
.user-info:focus-visible,
.dropdown-item:focus-visible,
.btn-outline-small:focus-visible,
.cart-link:focus-visible,
.mobile-btn:focus-visible,
.mobile-menu-close:focus-visible,
.social-link:focus-visible,
.submenu-toggle:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

/* Fallback for browsers without :focus-visible */
.nav-menu a:focus,
.cta-button:focus,
.mobile-menu-toggle:focus,
.mobile-nav-menu a:focus,
.user-info:focus,
.dropdown-item:focus {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

/* User menu focus states */
.user-info:focus {
  background: rgba(139, 92, 246, 0.2);
  border-color: #8b5cf6;
}

.dropdown-item:focus {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.logout-item:focus {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .site-header {
    background: #000;
    border-bottom-color: #fff;
  }

  .nav-menu a,
  .mobile-nav-menu a {
    color: #fff;
  }

  .nav-menu .sub-menu {
    background: #000;
    border-color: #fff;
  }

  .nav-menu .sub-menu a {
    color: #fff;
  }

  .cta-button {
    background: #fff;
    color: #000;
  }

  .user-dropdown {
    background: #000;
    border-color: #fff;
  }

  .cart-link {
    border-color: #fff;
    color: #fff;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  .site-header {
    position: static;
    background: #fff;
    border-bottom: 1px solid #333;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0.5rem 0;
  }

  body {
    padding-top: 0 !important;
  }

  .mobile-menu-toggle,
  .mobile-navigation,
  .header-cta,
  .loading-overlay,
  .user-menu,
  .header-cart {
    display: none !important;
  }

  .nav-menu a {
    color: #000;
  }

  .logo-text {
    -webkit-text-fill-color: #000;
    color: #000;
  }
}
