/* Maher fixed header and footer — intentionally loaded after all theme customization. */

/* Branded refresh loader */
.maher-page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  background: var(--hkm-bg);
  background: color-mix(in srgb, var(--hkm-bg) 72%, transparent);
  backdrop-filter: blur(15px) saturate(.75);
  -webkit-backdrop-filter: blur(15px) saturate(.75);
  transition: opacity .46s ease, visibility .46s ease;
  animation: maher-loader-failsafe 4s step-end forwards;
}

.maher-page-loader::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--hkm-primary) 13%, transparent), transparent 27%),
    linear-gradient(180deg, color-mix(in srgb, var(--hkm-surface) 48%, transparent), color-mix(in srgb, var(--hkm-bg) 78%, transparent));
}

.maher-page-loader.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.maher-page-loader__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.maher-page-loader__spinner {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: rgba(255, 255, 255, .82);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 18 16;
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, .2));
  animation: maher-loader-spin .82s linear infinite;
}

.maher-page-loader__logo {
  display: grid;
  place-items: center;
  animation: maher-loader-logo 1.05s ease-in-out infinite;
}

.maher-page-loader__logo img {
  width: auto;
  max-width: min(290px, 58vw);
  max-height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .38));
}

.maher-page-loader__logo strong {
  color: var(--hkm-primary-light);
  font-size: clamp(30px, 8vw, 64px);
}

@keyframes maher-loader-spin { to { transform: rotate(360deg); } }
@keyframes maher-loader-logo {
  0%, 100% { opacity: .58; transform: scale(.965); filter: brightness(.82); }
  46% { opacity: 1; transform: scale(1.025); filter: brightness(1.13); }
  62% { opacity: .72; transform: scale(.99); filter: brightness(.92); }
  78% { opacity: 1; transform: scale(1.01); filter: brightness(1.08); }
}
@keyframes maher-loader-failsafe {
  0%, 99% { visibility: visible; pointer-events: auto; }
  100% { visibility: hidden; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  .maher-page-loader__logo { animation: none; }
  .maher-page-loader__spinner { animation-duration: 1.5s; }
}

.maher-fixed-header {
  position: sticky !important;
  top: 0;
  z-index: 1900;
  display: block !important;
  color: var(--hkm-text) !important;
  background: var(--hkm-bg) !important;
  background: color-mix(in srgb, var(--hkm-bg) 97%, transparent) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--hkm-primary) !important;
  border-bottom-color: color-mix(in srgb, var(--hkm-primary) 18%, transparent) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .24) !important;
  backdrop-filter: blur(18px);
}

.maher-fixed-header::after { display: none !important; }

body.admin-bar .maher-fixed-header { top: 32px !important; }

.maher-fixed-header__row {
  min-height: 108px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center;
  gap: 28px;
}

.maher-fixed-header__primary,
.maher-fixed-header__utilities {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 15px;
}

.maher-fixed-header__primary {
  grid-column: 1;
  justify-content: flex-start;
}

.maher-fixed-header__brand {
  grid-column: 2;
  justify-self: center;
}

.maher-fixed-header__utilities {
  grid-column: 3;
  justify-content: flex-end;
}

.maher-fixed-header__brand .custom-logo-link,
.maher-fixed-header__brand > a {
  display: flex;
  align-items: center;
  justify-content: center;
}

.maher-fixed-header__brand .custom-logo,
.maher-fixed-header__brand .hkm-brand__img {
  width: auto !important;
  max-width: 220px !important;
  max-height: 72px !important;
  object-fit: contain;
}

.maher-header-menu,
.maher-header-icon,
.maher-fixed-cart {
  min-width: 46px !important;
  min-height: 46px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px !important;
  color: var(--hkm-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

.maher-header-menu {
  width: auto !important;
  font-size: 18px !important;
  font-weight: 600 !important;
}

.maher-header-menu:hover,
.maher-header-icon:hover,
.maher-fixed-cart:hover {
  color: var(--hkm-primary-light) !important;
  background: color-mix(in srgb, var(--hkm-primary) 10%, transparent) !important;
  transform: none !important;
}

.maher-header-menu svg,
.maher-header-icon svg,
.maher-fixed-cart svg {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maher-header-menu svg { color: var(--hkm-primary); }

.maher-header-currency {
  color: var(--hkm-muted);
  white-space: nowrap;
  font-size: 14px;
}

.maher-fixed-cart { position: relative; }
.maher-fixed-cart .hkm-cart__total {
  color: var(--hkm-on-primary);
  font-size: 13px;
  white-space: nowrap;
}
.maher-fixed-cart .hkm-cart__count {
  top: 1px;
  right: 0;
  min-width: 20px;
  height: 20px;
  color: var(--hkm-on-danger);
  background: var(--hkm-danger);
  border: 2px solid var(--hkm-bg);
}

.maher-fixed-drawer {
  color: var(--hkm-text);
  background: var(--hkm-surface) !important;
  border-color: var(--hkm-primary) !important;
}

/* Fixed footer */
.maher-fixed-footer {
  position: relative;
  display: block !important;
  padding: 70px 0 28px;
  color: var(--hkm-text) !important;
  background: var(--hkm-bg) !important;
  background-image: radial-gradient(circle at 82% 28%, color-mix(in srgb, var(--hkm-primary) 8%, transparent), transparent 30%) !important;
  border: 0 !important;
  border-top: 1px solid var(--hkm-primary) !important;
  border-top-color: color-mix(in srgb, var(--hkm-primary) 16%, transparent) !important;
}

.maher-fixed-footer__prelude {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  margin-bottom: 48px;
}

.maher-back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--hkm-muted) !important;
  font-size: 16px;
}
.maher-back-to-top:hover { color: var(--hkm-primary-light) !important; }

.maher-footer-social,
.maher-contact-icons,
.maher-payment-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.maher-footer-social a,
.maher-contact-icons a {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--hkm-text) !important;
  background: var(--hkm-surface-2);
  border: 1px solid var(--hkm-primary);
  border-color: color-mix(in srgb, var(--hkm-primary) 14%, transparent);
  border-radius: 15px;
}

.maher-footer-social a:hover,
.maher-contact-icons a:hover {
  color: var(--hkm-primary-light) !important;
  border-color: var(--hkm-primary);
}

.maher-footer-social svg,
.maher-contact-icons svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maher-footer-social span { font-size: 29px; line-height: 1; }

.maher-footer-panel {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr .8fr;
  gap: clamp(28px, 4vw, 70px);
  padding: clamp(32px, 5vw, 60px);
  border: 1.5px solid var(--hkm-primary);
  border-color: color-mix(in srgb, var(--hkm-primary) 72%, transparent);
  border-radius: 32px;
  background: linear-gradient(145deg, var(--hkm-surface), var(--hkm-bg));
  background: linear-gradient(145deg, color-mix(in srgb, var(--hkm-surface) 92%, transparent), color-mix(in srgb, var(--hkm-bg) 96%, transparent));
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}

.maher-footer-panel section { min-width: 0; }

.maher-footer-panel h3 {
  margin: 0 0 22px !important;
  color: var(--hkm-primary-light) !important;
  font-size: 20px !important;
  line-height: 1.4;
}

.maher-footer-panel p,
.maher-footer-panel a,
.maher-footer-panel li {
  color: var(--hkm-text) !important;
  font-size: 15px;
  line-height: 1.9;
}

.maher-footer-logo .custom-logo-link,
.maher-footer-logo > a { display: inline-flex; }

.maher-footer-logo .custom-logo,
.maher-footer-logo img {
  width: auto !important;
  max-width: 240px !important;
  max-height: 100px !important;
  object-fit: contain;
}

.maher-footer-brand p { margin: 18px 0 0; }

.maher-footer-links .menu {
  list-style: none;
  margin: 0;
  padding: 0;
}
.maher-footer-links .menu li { margin: 7px 0; }
.maher-footer-links .menu a:hover { color: var(--hkm-primary-light) !important; }

.maher-footer-contact-text {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.maher-footer-document strong {
  display: block;
  margin-top: 8px;
  color: var(--hkm-text);
  font-size: 17px;
  letter-spacing: .02em;
}

.maher-footer-closing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-top: 24px;
}

.maher-footer-closing p {
  margin: 0;
  color: var(--hkm-muted) !important;
  font-size: 13px;
}

.maher-payment-badges { flex-wrap: wrap; }
.maher-payment-badges span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 13px;
  color: var(--hkm-text);
  background: var(--hkm-surface-2);
  border: 1px solid var(--hkm-border);
  border-radius: 6px;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 800;
}
.maher-payment-badges img { width: auto; max-width: 110px; max-height: 26px; margin: 0; object-fit: contain; }

.maher-floating-whatsapp {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1800;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: var(--hkm-on-success) !important;
  background: var(--hkm-success);
  border: 4px solid color-mix(in srgb, var(--hkm-text) 90%, transparent);
  border-radius: 50%;
  box-shadow: 0 14px 32px rgba(0, 0, 0, .3);
}
.maher-floating-whatsapp:hover { color: var(--hkm-on-success) !important; transform: translateY(-3px); }
.maher-floating-whatsapp svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The shell stays visible on checkout and all WooCommerce endpoints. */
.woocommerce-checkout .maher-fixed-header,
.woocommerce-checkout .maher-fixed-footer { display: block !important; }

@media (max-width: 900px) {
  .maher-header-currency,
  .maher-fixed-cart .hkm-cart__total { display: none !important; }

  .maher-footer-panel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 782px) {
  body.admin-bar .maher-fixed-header { top: 46px !important; }
}

@media (max-width: 720px) {
  .maher-fixed-header__row {
    min-height: 112px !important;
    width: calc(100% - 24px) !important;
    grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr) !important;
    gap: 8px;
  }

  .maher-fixed-header__primary,
  .maher-fixed-header__utilities { gap: 2px; }

  .maher-header-menu span { display: none !important; }

  .maher-header-menu,
  .maher-header-icon,
  .maher-fixed-cart {
    min-width: 41px !important;
    min-height: 41px !important;
    padding: 5px !important;
  }

  .maher-header-menu svg,
  .maher-header-icon svg,
  .maher-fixed-cart svg {
    width: 27px;
    height: 27px;
  }

  .maher-fixed-header__brand .custom-logo,
  .maher-fixed-header__brand .hkm-brand__img {
    max-width: 172px !important;
    max-height: 68px !important;
  }

  .maher-fixed-footer { padding-top: 54px; }
  .maher-fixed-footer__prelude { margin-bottom: 38px; }

  .maher-footer-panel {
    width: calc(100% - 24px) !important;
    grid-template-columns: 1fr;
    gap: 42px;
    padding: 44px 24px;
    border-radius: 28px;
    text-align: center;
  }

  .maher-footer-panel section { width: 100%; }
  .maher-footer-logo .custom-logo-link,
  .maher-footer-logo > a { justify-content: center; }
  .maher-footer-logo .custom-logo,
  .maher-footer-logo img { max-width: 250px !important; max-height: 112px !important; }

  .maher-footer-links .menu,
  .maher-footer-contact { text-align: center; }

  .maher-footer-closing {
    flex-direction: column;
    justify-content: center;
    padding-top: 30px;
    text-align: center;
  }

  .maher-payment-badges { order: 1; }
  .maher-footer-closing p { order: 2; font-size: 13px; }

  .maher-floating-whatsapp {
    right: 16px;
    bottom: 18px;
    width: 58px;
    height: 58px;
  }
}

@media (max-width: 390px) {
  .maher-fixed-header__row {
    width: calc(100% - 14px) !important;
    grid-template-columns: minmax(66px, 1fr) auto minmax(66px, 1fr) !important;
  }
  .maher-fixed-header__brand .custom-logo,
  .maher-fixed-header__brand .hkm-brand__img { max-width: 138px !important; }
  .maher-header-menu,
  .maher-header-icon,
  .maher-fixed-cart { min-width: 36px !important; }
}
