/* ==========================================================================
   WebWizBD Native Mobile App Experience Stylesheet
   Pure CSS Nesting • Zero !important Specificity • Safe-Area Compliant
   ========================================================================== */

/* --------------------------------------------------------------------------
   Desktop Default: Mobile App UI Hidden on Screens >= 992px
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
  #tp-mobile-tab-bar,
  #tp-mobile-sheet-overlay {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Mobile App Shell (< 992px)
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  /* Native App Experience: Hide Persistent Browser Scrollbars */
  html,
  body {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 100vw;
    overflow-x: clip;

    &::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }
  }

  .wp-site-blocks,
  main {
    max-width: 100vw;
    overflow-x: clip;
    box-sizing: border-box;
  }

  /* Ensure Inner Drawers, Sheets and Containers Also Hide Scrollbars */
  * {
    scrollbar-width: none;
    -ms-overflow-style: none;

    &::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }
  }

  /* Body Bottom Clearance for Fixed Tab Bar on standard content pages */
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  /* Remove Footer on Smartphone for All Pages */
  footer,
  footer.wp-block-template-part,
  .wp-block-template-part[tagName="footer"],
  .tp-footer-section,
  .wp-block-group.tp-footer-section {
    display: none !important;
  }

  /* ------------------------------------------------------------------------
     Smartphone App Home Screen
     ------------------------------------------------------------------------ */
  html:has(body.home),
  html:has(body.tp-app-home-screen),
  body.tp-app-home-screen,
  body.home {
    /* Seamless atmospheric background matching hero */
    background: linear-gradient(135deg, #f8fafc 0%, #f1f6fc 50%, #f9fbfe 100%);
    min-height: 100vh;

    .wp-site-blocks,
    main {
      background: transparent;
    }

    /* On smartphone homepage, show only the hero section */
    main.wp-block-group {
      > *:not(.tp-hero-two-col) {
        display: none;
      }
    }

    footer,
    footer.tp-site-footer,
    .wp-block-template-part:has(footer) {
      display: none;
    }

    .tp-hero-two-col {
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      /* Sleek spacing below the mobile header pill */
      padding-top: calc(86px + env(safe-area-inset-top, 0px));
      padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
      box-sizing: border-box;
      background: transparent;
      overflow: hidden;
      max-width: 100vw;

      .tp-hero-two-col__main-wrap {
        width: 100%;
        margin-top: 0;
      }

      .tp-hero-google-badge {
        margin-top: 0;
        margin-bottom: 12px;
      }

      .tp-hero-two-col__title {
        font-size: clamp(28px, 6.8vw, 36px);
        line-height: 1.18;
        margin-bottom: 14px;
        text-align: center;
        margin-inline: auto;
      }

      .tp-hero-two-col__desc {
        font-size: clamp(15px, 3.8vw, 16.5px);
        line-height: 1.6;
        margin-bottom: 22px;
        text-align: center;
        margin-inline: auto;
      }

      .tp-hero-two-col__btns {
        margin-bottom: 16px;
        gap: 12px;
        justify-content: center;
        margin-inline: auto;

        .wp-block-button__link {
          padding: 12px 24px;
          font-size: 15px;
          font-weight: 600;
        }
      }

      .tp-hero-growth-showcase {
        margin: 14px auto 0 auto;
        padding: 12px 10px;

        .tp-floating-card--main {
          padding: 22px 20px 0 20px;
        }

        .tp-floating-card__big-number {
          font-size: clamp(34px, 7.8vw, 42px);
          margin-bottom: 4px;
        }

        .tp-floating-card__chart-wrapper {
          height: 90px;
          margin-top: 10px;
        }

        .tp-floating-card--leads {
          top: -10px;
          right: 0;
          padding: 8px 14px;
        }

        .tp-floating-card--ranking {
          bottom: -10px;
          left: 0;
          padding: 8px 14px;
        }
      }

      .tp-hero-bottom-proofs {
        display: none;
      }
    }

    .tp-hero-bottom-proofs {
      display: none;
    }
  }

  /* ------------------------------------------------------------------------
     Non-Sticky Mobile Top Header (Scrolls Naturally with Page)
     ------------------------------------------------------------------------ */
  .wp-block-group.tp-site-header,
  .tp-site-header,
  .site-header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    transform: none !important;
    z-index: 999 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 0 0 0 !important;
    margin: 0 !important;

    &.tp-header-hidden,
    &.tp-header-scrolled,
    &.is-scrolled,
    &.header-sticky {
      position: absolute !important;
      top: 0 !important;
      left: 0 !important;
      right: 0 !important;
      transform: none !important;
      background: transparent !important;
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
      border: none !important;
      box-shadow: none !important;
      padding: calc(8px + env(safe-area-inset-top, 0px)) 0 0 0 !important;
    }

    .tp-header-navbar {
      width: calc(100% - 24px) !important;
      margin: 0 auto !important;
      height: 50px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: space-between !important;
      pointer-events: auto !important;
    }

    /* Completely Remove Topbar Navigation & Menu on Mobile */
    .tp-header-center,
    .tp-header-nav,
    .wp-block-navigation,
    .wp-block-navigation__container,
    .wp-block-navigation-item,
    .wp-block-navigation__responsive-container-open,
    .wp-block-navigation__responsive-container-close,
    .wp-block-navigation__responsive-container,
    .wp-block-navigation__responsive-dialog {
      display: none !important;
    }

    .tp-header-left {
      flex: 1;

      .tp-header-brand__logo {
        font-size: 22px;
      }
    }

    .tp-header-right {
      flex-shrink: 0;
      display: flex !important;
      align-items: center !important;
      justify-content: flex-end !important;

      .tp-header-phone-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        width: 38px !important;
        height: 38px !important;
        border-radius: 50% !important;
        background: rgba(37, 99, 235, 0.08) !important;
        border: 1px solid rgba(37, 99, 235, 0.16) !important;
        color: #1d4ed8 !important;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        text-decoration: none !important;

        .tp-header-phone-btn__text {
          display: none !important;
        }

        svg,
        .tp-header-phone-btn__icon {
          width: 18px !important;
          height: 18px !important;
          fill: currentColor !important;
          flex-shrink: 0;
          display: block !important;
        }

        &:active {
          transform: scale(0.92);
          background: rgba(37, 99, 235, 0.16) !important;
        }
      }
    }
  }

  /* Global Fallback: Ensure Nav Center & Hamburger Toggle are Completely Hidden on Mobile */
  .wp-block-navigation__responsive-container-open,
  .wp-block-navigation__responsive-container-close,
  .wp-block-navigation__responsive-container,
  .wp-block-navigation__responsive-dialog,
  .tp-header-center,
  .tp-header-nav {
    display: none !important;
  }

  /* Inner Hero Banner Clearance on Mobile (< 992px) */
  .wp-block-group.tp-inner-hero-section,
  .tp-inner-hero-section,
  .tp-pricing-hero,
  .tp-services-hero,
  .tp-products-hero,
  .tp-single-work__hero,
  .tp-404-section {
    padding-top: calc(86px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: 35px !important;

    .tp-inner-hero__badge,
    .tp-single-work__badge {
      display: inline-block;
      font-size: 11px;
      padding: 4px 12px;
      margin-top: 0;
      margin-bottom: 12px;
    }

    .tp-inner-hero__title,
    .tp-single-work__title {
      font-size: 26px;
      line-height: 1.25;
      margin-top: 0;
      margin-bottom: 8px;
    }
  }

  /* ------------------------------------------------------------------------
     Fixed Native Bottom Tab Bar (Sleek Floating Pill: Light Blue + White Glass)
     ------------------------------------------------------------------------ */
  .tp-mobile-tab-bar {
    position: fixed;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    z-index: 9998;
    width: calc(100% - 24px);
    max-width: 420px;
    margin: 0 auto;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.90) 0%, rgba(238, 246, 255, 0.92) 50%, rgba(220, 238, 255, 0.88) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow:
      0 10px 28px rgba(37, 99, 235, 0.12),
      0 3px 10px rgba(15, 23, 42, 0.04),
      inset 0 1px 2px rgba(255, 255, 255, 1);
    padding: 3px 4px;
    user-select: none;
    -webkit-user-select: none;

    &.tp-mobile-tab-bar--edge {
      bottom: 0;
      width: 100%;
      max-width: 100%;
      border-radius: 0;
      border-left: none;
      border-right: none;
      border-bottom: none;
      padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    }

    .tp-mobile-tab-bar__inner {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      align-items: center;
      justify-items: center;
      width: 100%;
      height: 42px;
      position: relative;
    }

    /* Standard Tab Item */
    .tp-tab-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 1.5px;
      width: 100%;
      height: 100%;
      background: transparent;
      border: none;
      padding: 2px 0;
      color: #64748b;
      text-decoration: none;
      font-size: 10px;
      font-weight: 500;
      border-radius: 999px;
      letter-spacing: 0.01em;
      white-space: nowrap;
      transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
      cursor: pointer;
      outline: none;

      .tp-tab-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);

        svg {
          width: 18px;
          height: 18px;
          stroke: currentColor;
          transition: stroke 0.2s ease;
        }
      }

      .tp-tab-label {
        line-height: 1;
        transition: transform 0.2s ease;
      }

      /* Active State (Royal Blue Glow on Soft Pill) */
      &.is-active {
        color: #1d4ed8;
        background: rgba(37, 99, 235, 0.09);

        .tp-tab-icon {
          transform: translateY(-1px) scale(1.06);

          svg {
            stroke: #1d4ed8;
          }
        }

        .tp-tab-label {
          font-weight: 700;
          color: #1d4ed8;
        }
      }

      /* Tactile Spring Press */
      &:active {
        transform: scale(0.92);
        background: rgba(37, 99, 235, 0.14);
        color: #1d4ed8;
      }
    }
  }

  /* ------------------------------------------------------------------------
     Native Swipeable Bottom Sheet ("More" Drawer)
     ------------------------------------------------------------------------ */
  .tp-mobile-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    flex-direction: column;
    justify-content: flex-end;
    visibility: hidden;
    overflow: hidden;
    contain: paint;
    pointer-events: none;
    transition: visibility 0.35s ease;

    &.is-open {
      display: flex;
      visibility: visible;
      pointer-events: auto;

      .tp-sheet-backdrop {
        opacity: 1;
      }

      .tp-mobile-sheet {
        transform: translateY(0);
      }
    }

    /* Blur Backdrop */
    .tp-sheet-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      opacity: 0;
      transition: opacity 0.35s ease;
      cursor: pointer;
    }

    /* Sheet Dialog Container (Clean Light Blue + White Glass) */
    .tp-mobile-sheet {
      position: relative;
      z-index: 2;
      width: 100%;
      max-height: 88vh;
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 248, 255, 0.98) 100%);
      border-top: 1px solid rgba(219, 234, 254, 0.85);
      border-radius: 28px 28px 0 0;
      box-shadow: 0 -12px 48px rgba(15, 23, 42, 0.16);
      backdrop-filter: blur(28px);
      -webkit-backdrop-filter: blur(28px);
      transform: translateY(100%);
      transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;

      /* Drag Handle Zone */
      .tp-sheet-drag-handle-zone {
        padding: 12px 0 6px;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: grab;
        touch-action: none;

        .tp-sheet-drag-handle {
          width: 44px;
          height: 5px;
          border-radius: 999px;
          background: rgba(100, 116, 139, 0.3);
          transition: background-color 0.2s ease, transform 0.2s ease;
        }

        &:active .tp-sheet-drag-handle {
          background: rgba(37, 99, 235, 0.5);
          transform: scaleX(1.1);
        }
      }

      /* Sheet Header */
      .tp-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 20px 16px;
        border-bottom: 1px solid rgba(226, 232, 240, 0.8);

        .tp-sheet-brand {
          display: flex;
          align-items: center;
          gap: 12px;

          .tp-sheet-logo {
            font-size: 18px;
            font-weight: 800;
            color: #0f172a;
            letter-spacing: -0.02em;

            .tp-sheet-logo-accent {
              color: #2563eb;
            }
          }

          .tp-sheet-status-pill {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(16, 185, 129, 0.08);
            border: 1px solid rgba(16, 185, 129, 0.25);
            border-radius: 999px;
            padding: 2px 10px;

            .tp-status-dot {
              width: 6px;
              height: 6px;
              border-radius: 50%;
              background: #10b981;
              box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
            }

            .tp-status-text {
              font-size: 10.5px;
              font-weight: 600;
              color: #059669;
            }
          }
        }

        .tp-sheet-close-btn {
          display: flex;
          align-items: center;
          justify-content: center;
          width: 34px;
          height: 34px;
          border-radius: 50%;
          background: rgba(15, 23, 42, 0.06);
          border: 1px solid rgba(15, 23, 42, 0.06);
          color: #475569;
          cursor: pointer;
          transition: background-color 0.2s ease, transform 0.15s ease;
          outline: none;

          &:active {
            transform: scale(0.92);
            background: rgba(15, 23, 42, 0.12);
          }
        }
      }

      /* Sheet Body Content */
      .tp-sheet-body {
        padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));

        .tp-sheet-section-title {
          font-size: 11px;
          font-weight: 700;
          text-transform: uppercase;
          letter-spacing: 0.08em;
          color: #64748b;
          margin-bottom: 10px;
          margin-top: 4px;
        }

        /* Navigation Grid */
        .tp-sheet-grid {
          display: flex;
          flex-direction: column;
          gap: 8px;
          margin-bottom: 22px;

          .tp-sheet-tile {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 12px 14px;
            background: #ffffff;
            border: 1px solid rgba(226, 232, 240, 0.9);
            box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
            border-radius: 16px;
            text-decoration: none;
            color: #0f172a;
            transition: background-color 0.2s ease, transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.2s ease;
            outline: none;

            .tp-sheet-tile__icon {
              display: flex;
              align-items: center;
              justify-content: center;
              width: 40px;
              height: 40px;
              border-radius: 12px;
              flex-shrink: 0;

              &.tp-icon-services {
                background: rgba(14, 165, 233, 0.1);
                border: 1px solid rgba(14, 165, 233, 0.2);
                color: #0ea5e9;
              }

              &.tp-icon-work {
                background: rgba(99, 102, 241, 0.1);
                border: 1px solid rgba(99, 102, 241, 0.2);
                color: #6366f1;
              }

              &.tp-icon-about {
                background: rgba(37, 99, 235, 0.1);
                border: 1px solid rgba(37, 99, 235, 0.2);
                color: #2563eb;
              }

              &.tp-icon-contact {
                background: rgba(236, 72, 153, 0.1);
                border: 1px solid rgba(236, 72, 153, 0.2);
                color: #ec4899;
              }
            }

            .tp-sheet-tile__content {
              display: flex;
              flex-direction: column;
              gap: 2px;
              flex-grow: 1;

              .tp-sheet-tile__title {
                font-size: 14.5px;
                font-weight: 600;
                color: #0f172a;
              }

              .tp-sheet-tile__sub {
                font-size: 11.5px;
                color: #64748b;
              }
            }

            .tp-sheet-tile__arrow {
              font-size: 16px;
              color: #94a3b8;
              transition: transform 0.2s ease, color 0.2s ease;
            }

            &:active {
              transform: scale(0.98);
              background: #f8fafc;
              border-color: rgba(37, 99, 235, 0.3);

              .tp-sheet-tile__arrow {
                transform: translateX(3px);
                color: #2563eb;
              }
            }
          }
        }

        /* Quick Action Cards */
        .tp-sheet-actions {
          display: flex;
          flex-direction: column;
          gap: 10px;
          margin-bottom: 20px;

          .tp-sheet-action-card {
            position: relative;
            display: block;
            width: 100%;
            padding: 14px 16px;
            border-radius: 16px;
            text-align: left;
            text-decoration: none;
            cursor: pointer;
            border: 1px solid transparent;
            transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, border-color 0.2s ease;
            outline: none;

            .tp-action-card__badge {
              position: absolute;
              top: 10px;
              right: 14px;
              font-size: 9.5px;
              font-weight: 700;
              text-transform: uppercase;
              letter-spacing: 0.05em;
              padding: 2px 8px;
              border-radius: 999px;
            }

            .tp-action-card__inner {
              display: flex;
              align-items: center;
              gap: 14px;

              .tp-action-card__icon {
                display: flex;
                align-items: center;
                justify-content: center;
                width: 44px;
                height: 44px;
                border-radius: 12px;
                flex-shrink: 0;
              }

              .tp-action-card__text {
                display: flex;
                flex-direction: column;
                gap: 2px;

                .tp-action-card__title {
                  font-size: 14.5px;
                  font-weight: 700;
                }

                .tp-action-card__desc {
                  font-size: 11.5px;
                  opacity: 0.8;
                }
              }
            }

            /* Fast Quote Card (Blue Accent) */
            &.tp-action-quote {
              background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(59, 130, 246, 0.04) 100%);
              border-color: rgba(37, 99, 235, 0.25);
              color: #0f172a;

              .tp-action-card__badge {
                background: rgba(37, 99, 235, 0.12);
                color: #1d4ed8;
                border: 1px solid rgba(37, 99, 235, 0.2);
              }

              .tp-action-card__icon {
                background: linear-gradient(135deg, #2563eb, #1d4ed8);
                color: #ffffff;
                box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
              }

              &:active {
                transform: scale(0.97);
                border-color: rgba(37, 99, 235, 0.5);
              }
            }

            /* WhatsApp / Direct Call Card */
            &.tp-action-call,
            &.tp-action-whatsapp {
              background: #ffffff;
              border-color: rgba(226, 232, 240, 0.9);
              box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
              color: #0f172a;

              .tp-action-card__icon {
                background: rgba(37, 211, 102, 0.12);
                color: #16a34a;
                border: 1px solid rgba(37, 211, 102, 0.25);
              }

              &:active {
                transform: scale(0.97);
                background: #f8fafc;
              }
            }

            /* PWA Install Card */
            &.tp-action-pwa {
              background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.03) 100%);
              border-color: rgba(16, 185, 129, 0.25);
              color: #0f172a;

              .tp-action-card__icon {
                background: linear-gradient(135deg, #10b981, #059669);
                color: #ffffff;
                box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
              }

              &:active {
                transform: scale(0.97);
                border-color: rgba(16, 185, 129, 0.4);
              }
            }
          }
        }

        /* Footer Strip */
        .tp-sheet-footer-strip {
          display: flex;
          flex-direction: column;
          align-items: center;
          gap: 4px;
          padding-top: 14px;
          border-top: 1px solid rgba(226, 232, 240, 0.8);
          text-align: center;

          .tp-sheet-footer-brand {
            font-size: 11.5px;
            color: #64748b;
            font-weight: 500;
          }

          .tp-sheet-footer-rights {
            font-size: 10px;
            color: #94a3b8;
          }
        }
      }
    }
  }
}

/* --------------------------------------------------------------------------
   Modern View Transitions API Animations (SPA feel)
   -------------------------------------------------------------------------- */
@keyframes tpViewFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.985);
  }
}

@keyframes tpViewFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::view-transition-old(root) {
  animation: 170ms ease-out both tpViewFadeOut;
}

::view-transition-new(root) {
  animation: 200ms ease-out both tpViewFadeIn;
}
