/* ============================================================================
   PWA PHASE 1 — Vishwakarma Fabrication Work Pvt. Ltd
   Unified navigation (same hamburger + drawer on every screen size),
   fixed bottom navigation, install app UI (button, iOS popup, footer cards).

   This file is loaded AFTER the theme's own CSS, so it only ADDS behaviour —
   nothing here deletes or rewrites existing PHP/HTML/JS.
   ============================================================================ */

/* -----------------------------------------------------------------------
   1) UNIFIED NAVIGATION (RE-ENABLED, this time without the overlap bug)
   HISTORY: this file previously force-hid .header-upper/.nav-outer/
   .right-column and force-showed .mobile-custom-header at every screen
   size via !important with no breakpoint condition, while header.php's
   own inline styles showed .header-upper at 768px+ via Bootstrap's
   d-none/d-md-block — two rulesets fighting each other, so on wide
   viewports both headers ended up visible at once. That's fixed now at
   the source: header.php's .header-upper div carries only "d-none" (no
   "d-md-block"), so it's hidden at every width, and .mobile-custom-header
   is shown unconditionally below — only one header can ever be on
   screen, on mobile or desktop alike.
   ----------------------------------------------------------------------- */
.mobile-custom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0D0D0D;
  color: #fff;
  padding: 12px 16px;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  gap: 8px;
  position: relative;
  z-index: 500;
}

.mobile-custom-header .logo img {
  max-height: 48px;
  background: #fff;
  border-radius: 6px;
  padding: 3px;
}

.mobile-custom-header .company-info {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: clamp(9px, 1.4vw, 13px);
  line-height: 1.3;
}

.mobile-custom-header .company-info strong {
  font-size: clamp(10px, 1.7vw, 15px);
  font-weight: 700;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-custom-header .company-info span {
  display: block;
  font-size: clamp(8px, 1.1vw, 11px);
  opacity: 0.9;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-custom-header .right-icons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  font-size: 19px;
  flex-shrink: 0;
}

.mobile-custom-header .right-icons i { cursor: pointer; }

@media (min-width: 768px) {
  .mobile-custom-header { padding: 14px 40px; }
  .mobile-custom-header .logo img { max-height: 54px; }
}

@media (min-width: 1300px) {
  .mobile-custom-header { padding: 16px 64px; }
}

/* Desktop keyboard accessibility for the hamburger toggler */
.mobile-nav-toggler {
  outline-offset: 4px;
}
.mobile-nav-toggler:focus-visible {
  outline: 2px solid #C9A227;
  border-radius: 4px;
}

/* Drawer: hover states + active menu highlight (desktop mouse users) */
@media (hover: hover) {
  .mobile-menu .navigation li > a:hover {
    color: #8B1A1A;
    padding-left: 4px;
    transition: all .2s ease;
  }
}
.mobile-menu .navigation li > a.pwa-active-link {
  color: #8B1A1A;
  font-weight: 700;
}
.mobile-menu .navigation li > a:focus-visible {
  outline: 2px solid #C9A227;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reserve space at the bottom of every page so the fixed bottom nav never
   covers footer content/buttons. */
body.has-pwa-bottom-nav {
  padding-bottom: 68px;
}
@media (min-width: 992px) {
  body.has-pwa-bottom-nav { padding-bottom: 76px; }
}

/* -----------------------------------------------------------------------
   2) INSTALL APP BUTTON (inside the drawer)
   ----------------------------------------------------------------------- */
.pwa-install-item { background: #14210f; }

.pwa-install-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #1f7a3f, #14a34a);
  color: #fff !important;
  border: none;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 0;
}
.pwa-install-btn i { font-size: 15px; }
.pwa-install-btn.pwa-installed {
  background: #1a3d2a;
  color: #7be3a3 !important;
  cursor: default;
}
.pwa-install-item.pwa-hidden { display: none !important; }

/* -----------------------------------------------------------------------
   3) FIXED BOTTOM NAVIGATION (app-like)
   ----------------------------------------------------------------------- */
.pwa-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9990;
  display: flex;
  background: rgba(13, 13, 13, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.pwa-bottom-nav a,
.pwa-bottom-nav button {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 4px 8px;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  border: none;
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.pwa-bottom-nav a i,
.pwa-bottom-nav button i {
  font-size: 19px;
  line-height: 1;
}

.pwa-bottom-nav a.active,
.pwa-bottom-nav button.active {
  color: #C9A227;
}

.pwa-bottom-nav a:active,
.pwa-bottom-nav button:active {
  transform: scale(0.92);
}

.pwa-bottom-nav .pwa-nav-quote i {
  color: #fff;
  background: linear-gradient(135deg, #8B1A1A, #C9A227);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-top: -14px;
  box-shadow: 0 4px 12px rgba(139, 26, 26, 0.5);
}
.pwa-bottom-nav .pwa-nav-quote.active i,
.pwa-bottom-nav .pwa-nav-quote:active i { color: #fff; }

.pwa-bottom-nav .pwa-nav-whatsapp i { color: #25D366; }

@media (min-width: 1300px) {
  .pwa-bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: 22px 22px 0 0; }
}

/* Hide bottom nav automatically while the side drawer is open, so both
   overlays never compete for taps. */
body.pwa-drawer-open .pwa-bottom-nav { display: none; }

/* -----------------------------------------------------------------------
   4) iOS "ADD TO HOME SCREEN" PREMIUM POPUP
   ----------------------------------------------------------------------- */
.pwa-ios-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.pwa-ios-overlay.active { display: flex; }

.pwa-ios-sheet {
  width: 100%;
  max-width: 460px;
  background: #161616;
  color: #fff;
  border-radius: 24px 24px 0 0;
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: pwaSheetUp 0.28s ease-out;
}
@keyframes pwaSheetUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pwa-ios-sheet .pwa-ios-handle {
  width: 42px;
  height: 4px;
  background: #444;
  border-radius: 4px;
  margin: 0 auto 18px;
}

.pwa-ios-sheet h3 {
  font-size: 18px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-ios-sheet p.pwa-ios-sub {
  color: #a8a8a8;
  font-size: 13.5px;
  margin: 0 0 20px;
}

.pwa-ios-steps { list-style: none; margin: 0 0 22px; padding: 0; }
.pwa-ios-steps li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}
.pwa-ios-steps li:last-child { border-bottom: none; }
.pwa-ios-steps .pwa-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B1A1A, #C9A227);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.pwa-ios-steps .pwa-step-icon { font-size: 17px; color: #C9A227; width: 22px; text-align: center; }

.pwa-ios-close-btn {
  width: 100%;
  background: linear-gradient(135deg, #8B1A1A, #C9A227);
  color: #fff;
  border: none;
  padding: 13px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
}

/* -----------------------------------------------------------------------
   5) FOOTER — PREMIUM "INSTALL APP" SECTION
   ----------------------------------------------------------------------- */
.pwa-footer-install {
  background: #0D0D0D;
  padding: 48px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.pwa-footer-install .pwa-install-inner {
  max-width: 1000px;
  margin: 0 auto;
}
.pwa-footer-install h2 {
  color: #fff;
  text-align: center;
  font-size: clamp(20px, 3vw, 28px);
  margin: 0 0 8px;
}
.pwa-footer-install .pwa-install-tagline {
  text-align: center;
  color: #a8a8a8;
  font-size: 14px;
  margin: 0 0 32px;
}
.pwa-store-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
}
.pwa-store-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 10px 20px 10px 16px;
  min-width: 190px;
  cursor: pointer;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.pwa-store-badge:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
  border-color: rgba(201, 162, 39, 0.5);
}
.pwa-store-badge i {
  font-size: 30px;
  color: #fff;
  flex-shrink: 0;
}
.pwa-badge-android i { color: #3DDC84; }
.pwa-badge-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.pwa-badge-text small {
  font-size: 10.5px;
  font-weight: 400;
  color: #cfcfcf;
  letter-spacing: 0.3px;
}
.pwa-store-badge:disabled {
  opacity: 0.55;
  cursor: default;
}
.pwa-store-badge:disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.18);
}

/* -----------------------------------------------------------------------
   6) LOADING / TRANSITIONS (lightweight app feel)
   ----------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .pwa-page-fade { animation: pwaFadeIn 0.28s ease both; }
}
@keyframes pwaFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pwa-skeleton {
  background: linear-gradient(90deg, #1c1c1c 25%, #262626 37%, #1c1c1c 63%);
  background-size: 400% 100%;
  animation: pwaSkeleton 1.4s ease infinite;
  border-radius: 10px;
}
@keyframes pwaSkeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
