/**
 * SKKIN Native Mobile App Styling & Bottom Navigation Dock
 * Provides an authentic mobile application feel on smartphone viewports.
 */

/* ==========================================================================
   1. VIEWPORT & SAFE AREA HANDLING (MOBILE ONLY)
   ========================================================================== */
@media (max-width: 991px) {
  html {
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    overflow-x: clip !important;
    max-width: 100% !important;
  }

  body {
    /* Ensure page content is never hidden behind the fixed bottom dock */
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-x: clip !important;
    max-width: 100% !important;
    width: 100% !important;
    position: relative !important;
  }

  #page,
  .site {
    overflow: visible !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #content,
  .site-content {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Smooth momentum touch scrolling for all carousels/lists */
  .fx-horizontal-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }

  .fx-horizontal-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }

  .fx-horizontal-scroll > * {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   2. FIXED BOTTOM APP NAVIGATION DOCK
   ========================================================================== */
.skkin-app-bottom-dock {
  display: none; /* Hidden on desktop */
}

@media (max-width: 991px) {
  .skkin-app-bottom-dock {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)) 12px;
    align-items: center;
    justify-content: space-around;
    user-select: none;
  }

  .skkin-app-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    padding: 4px 2px;
    text-decoration: none !important;
    color: #666666;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .skkin-app-tab:active {
    transform: scale(0.92);
  }

  .skkin-app-tab-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-bottom: 2px;
  }

  .skkin-app-tab-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    transition: stroke 0.2s ease, transform 0.2s ease;
  }

  .skkin-app-tab-label {
    font-family: var(--font-body, 'Poppins', sans-serif);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: #666666;
    transition: color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Active Tab State */
  .skkin-app-tab.is-active,
  .skkin-app-tab:hover {
    color: #e11d48;
  }

  .skkin-app-tab.is-active .skkin-app-tab-label,
  .skkin-app-tab:hover .skkin-app-tab-label {
    color: #e85a28;
    font-weight: 700;
  }

  .skkin-app-tab.is-active .skkin-app-tab-icon svg,
  .skkin-app-tab:hover .skkin-app-tab-icon svg {
    stroke: #e85a28;
  }

  /* Active Indicator Dot */
  .skkin-app-tab.is-active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2.5px;
    background: #e85a28;
    border-radius: 2px;
  }

  /* Offers Pulsing Glowing Dot */
  .skkin-tab-pulse-dot {
    position: absolute;
    top: -1px;
    right: -2px;
    width: 7px;
    height: 7px;
    background-color: #e85a28;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #ffffff;
    animation: fxGlowPulse 1.8s infinite;
  }

  @keyframes fxGlowPulse {
    0% {
      transform: scale(0.95);
      box-shadow: 0 0 0 0 rgba(232, 90, 40, 0.7);
    }
    70% {
      transform: scale(1.1);
      box-shadow: 0 0 0 6px rgba(232, 90, 40, 0);
    }
    100% {
      transform: scale(0.95);
      box-shadow: 0 0 0 0 rgba(232, 90, 40, 0);
    }
  }

  /* Bag Count Badge */
  .skkin-tab-badge {
    position: absolute;
    top: -3px;
    right: -6px;
    background: #e85a28;
    color: #ffffff;
    font-family: var(--font-body, 'Poppins', sans-serif);
    font-size: 10.5px;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 1.5px solid #ffffff;
    line-height: 1;
  }
}

/* ==========================================================================
   3. MOBILE APP HEADER BAR OPTIMIZATION
   ========================================================================== */
@media (max-width: 991px) {
  html {
    margin-top: 0 !important;
  }
  #wpadminbar {
    display: none !important;
  }
  /* Unified Sticky Header Wrapper (Top Bar + Header) */
  .admin-bar .skkin-sticky-header-wrapper,
  .skkin-sticky-header-wrapper {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 99998 !important;
    width: 100% !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #ffffff !important;
    margin: 0 !important;
  }

  .skkin-announcement-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .site-header {
    position: relative !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 60px !important;
    background: #ffffff !important;
  }

  .site-header .skkin-header-inner,
  .site-header .main-header {
    padding: 0 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
  }

  .site-header .skkin-header-left {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    z-index: 6 !important;
  }

  .site-header .site-branding {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto !important;
    height: auto !important;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 0 !important;
    z-index: 5 !important;
    max-width: calc(100% - 150px) !important;
    pointer-events: auto !important;
  }

  .site-branding .site-title a,
  .site-branding .skkin-brand-logo {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: -0.05em;
  }

  /* Hide excessive desktop menus on mobile */
  .col-full-nav,
  .shoptimizer-secondary-navigation {
    display: none !important;
  }

  /* Make search input look like an in-app search pill */
  .site-header .woocommerce-product-search,
  .skkin-mobile-search-trigger {
    background: #f4f4f5;
    border-radius: 9999px;
    padding: 6px 14px;
    font-size: 13px;
    color: #71717a;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
  }
}

