/**
 * Mobile Nav Pro — bottom dock + slide menu drawer
 */

@media (max-width: 991px) {
  :root {
    --bottom-nav-h: 64px;
    --sp-menu-w: min(100vw - 48px, 340px);
  }

  /* ── Hide clutter in mobile header ── */
  body.pd-layout .pd-topstrip {
    display: none;
  }

  body.pd-layout .pd-mobile-cat-strip {
    display: none;
  }

  body.pd-layout .pd-header-main {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
  }

  body.pd-layout .pd-header-logo img {
    height: 42px;
    width: auto;
  }

  body.pd-layout .pd-header-actions {
    gap: 8px;
  }

  body.pd-layout .pd-header-actions .pd-cart-pill,
  body.pd-layout .pd-header-actions .pd-header-pill:not(.pd-mobile-toggle) {
    display: none;
  }

  body.pd-layout .pd-mobile-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: #f4f7f1;
    color: var(--ds-forest, #3D6B1E);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px #dce8d0;
    transition: background 0.2s ease, transform 0.15s ease;
  }

  body.pd-layout .pd-mobile-toggle i {
    font-size: 1.05rem;
    color: var(--ds-forest, #3D6B1E);
  }

  body.pd-layout .pd-mobile-toggle:active {
    transform: scale(0.94);
    background: #eaf3e0;
  }

  body.pd-layout .pd-mobile-toggle--menu {
    background: linear-gradient(145deg, #3D6B1E, #2D5016);
    box-shadow: 0 4px 14px rgba(61, 107, 30, 0.28);
  }

  body.pd-layout .pd-mobile-toggle--menu i {
    color: #fff;
  }

  body.pd-layout .pd-savings-bar {
    font-size: 0.78rem;
    padding: 7px 12px;
    line-height: 1.35;
  }

  body.pd-layout .pd-site-header {
    background: #fff;
    box-shadow: 0 1px 0 #eef3e8;
  }

  /* ── Bottom navigation — flat pro dock ── */
  body.pd-layout .sp-bottom-nav.sanju-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    min-height: var(--bottom-nav-h);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #e8f0df;
    box-shadow: 0 -4px 24px rgba(17, 24, 39, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    align-items: stretch;
    justify-content: space-around;
    border-radius: 0;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    min-height: 52px;
    color: #94a3b8;
    text-decoration: none;
    border: none;
    background: transparent;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
  }

  body.pd-layout .sp-bottom-nav .sp-nav-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 28px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, #9ACD32, #3D6B1E);
    transition: transform 0.25s ease;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item.active .sp-nav-indicator {
    transform: translateX(-50%) scaleX(1);
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-icon-wrap {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    position: relative;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-shop .bottom-nav-icon-shop {
    width: auto;
    height: auto;
    margin: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item i {
    font-size: 1.2rem;
    color: #64748b;
    transition: color 0.2s ease, transform 0.2s ease;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item.active {
    color: var(--ds-forest, #3D6B1E);
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item.active i {
    color: var(--ds-forest, #3D6B1E);
    transform: translateY(-1px);
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item.active .bottom-nav-icon-wrap {
    background: transparent;
    box-shadow: none;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
    color: inherit;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-cart-count {
    top: -6px;
    right: -10px;
    min-width: 17px;
    height: 17px;
    font-size: 0.58rem;
    border-width: 1.5px;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item:active {
    transform: scale(0.96);
  }

  /* ── Menu drawer ── */
  body.pd-layout .sp-sidebar-overlay.sidebar-overlay {
    background: rgba(15, 23, 15, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  body.pd-layout .sp-mobile-menu.mobile-sidebar {
    left: calc(-1 * var(--sp-menu-w)) !important;
    width: var(--sp-menu-w) !important;
    max-width: var(--sp-menu-w) !important;
    height: 100dvh !important;
    background: #fff !important;
    color: var(--ds-ink, #111827) !important;
    box-shadow: 8px 0 40px rgba(17, 24, 39, 0.12) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: none !important;
    transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  body.pd-layout .sp-mobile-menu.mobile-sidebar.open {
    left: 0 !important;
    transform: none !important;
  }

  body.pd-layout .sp-bottom-nav.sanju-bottom-nav {
    display: flex !important;
    align-items: stretch !important;
    justify-content: space-around !important;
    border-radius: 0 !important;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item {
    flex: 1 1 0 !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 52px !important;
    background: transparent !important;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-icon-wrap,
  body.pd-layout .sp-bottom-nav .bottom-nav-shop .bottom-nav-icon-shop {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body.pd-layout .sp-bottom-nav .bottom-nav-item.active .bottom-nav-icon-wrap {
    background: transparent !important;
    box-shadow: none !important;
  }

  body.pd-layout .sp-mobile-menu .sp-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 14px;
    background: linear-gradient(135deg, #2D5016 0%, #3D6B1E 100%);
    color: #fff;
  }

  body.pd-layout .sp-menu-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
  }

  body.pd-layout .sp-menu-brand img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fff;
    padding: 4px;
    flex-shrink: 0;
  }

  body.pd-layout .sp-menu-brand strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
  }

  body.pd-layout .sp-menu-brand span {
    display: block;
    font-size: 0.6875rem;
    opacity: 0.85;
    margin-top: 2px;
  }

  body.pd-layout .sp-menu-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
  }

  body.pd-layout .sp-menu-close:active {
    background: rgba(255, 255, 255, 0.25);
  }

  body.pd-layout .sp-menu-user {
    padding: 14px 16px;
    border-bottom: 1px solid #eef3e8;
    background: #fafdf7;
  }

  body.pd-layout .sp-menu-user-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    align-items: center;
  }

  body.pd-layout .sp-menu-avatar {
    grid-row: 1 / 3;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, #9ACD32, #3D6B1E);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.pd-layout .sp-menu-user-info strong {
    display: block;
    font-size: 0.875rem;
    color: var(--ds-ink, #111827);
  }

  body.pd-layout .sp-menu-user-info span {
    display: block;
    font-size: 0.72rem;
    color: var(--ds-ink-subtle, #6B7280);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.pd-layout .sp-menu-user-link {
    grid-column: 2;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ds-forest, #3D6B1E);
    text-decoration: none;
  }

  body.pd-layout .sp-menu-auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  body.pd-layout .sp-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease;
  }

  body.pd-layout .sp-menu-btn:active {
    transform: scale(0.97);
  }

  body.pd-layout .sp-menu-btn-outline {
    border: 1px solid #dce8d0;
    background: #fff;
    color: var(--ds-forest, #3D6B1E);
  }

  body.pd-layout .sp-menu-btn-primary {
    background: linear-gradient(135deg, #9ACD32, #3D6B1E);
    color: #fff;
    box-shadow: 0 4px 14px rgba(61, 107, 30, 0.25);
  }

  body.pd-layout .sp-menu-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 16px;
    -webkit-overflow-scrolling: touch;
  }

  body.pd-layout .sp-menu-section {
    padding: 8px 16px 12px;
  }

  body.pd-layout .sp-menu-section-title {
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ds-ink-subtle, #6B7280);
    margin: 0 0 10px;
  }

  body.pd-layout .sp-menu-cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  body.pd-layout .sp-menu-cat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fbf4;
    border: 1px solid #eef3e8;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ds-ink, #111827);
    font-size: 0.75rem;
    font-weight: 700;
    min-height: 44px;
    transition: background 0.2s ease, border-color 0.2s ease;
  }

  body.pd-layout .sp-menu-cat-item:active {
    background: #ecfccb;
    border-color: #c5e89a;
  }

  body.pd-layout .sp-menu-cat-item i {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 8px;
    background: linear-gradient(145deg, #ecfccb, #d9f99d);
    color: var(--ds-forest, #3D6B1E);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
  }

  body.pd-layout .sp-menu-cat-img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    object-fit: cover;
    background: #fff;
    border: 1px solid #eef3e8;
  }

  body.pd-layout .sp-menu-cat-item span {
    line-height: 1.25;
  }

  body.pd-layout .sp-menu-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ds-forest, #3D6B1E);
    text-decoration: none;
  }

  body.pd-layout .sp-menu-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  body.pd-layout .sp-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ds-ink, #111827);
    font-size: 0.875rem;
    font-weight: 600;
    min-height: 48px;
    transition: background 0.2s ease;
  }

  body.pd-layout .sp-menu-link > i:first-child {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #f4f7f1;
    color: var(--ds-forest, #3D6B1E);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
  }

  body.pd-layout .sp-menu-link-wa > i:first-child {
    background: #dcfce7;
    color: #16a34a;
  }

  body.pd-layout .sp-menu-link span {
    flex: 1;
  }

  body.pd-layout .sp-menu-chevron {
    font-size: 0.65rem;
    color: #cbd5e1;
  }

  body.pd-layout .sp-menu-link.is-active,
  body.pd-layout .sp-menu-link:active {
    background: #f4faeb;
  }

  body.pd-layout .sp-menu-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eef3e8;
    background: #fafdf7;
  }

  body.pd-layout .sp-menu-footer-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ds-ink-muted, #4B5563);
    text-decoration: none;
  }

  body.pd-layout .sp-menu-footer-danger {
    color: #b91c1c;
  }

  /* Hide legacy sidebar blocks */
  body.pd-layout .sp-mobile-menu .sidebar-nav-section,
  body.pd-layout .sp-mobile-menu .sidebar-header,
  body.pd-layout .sp-mobile-menu .sidebar-user-section {
    display: none !important;
  }

  body.pd-layout .page-wrapper {
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  }
}

@media (min-width: 992px) {
  body.pd-layout .sp-bottom-nav,
  body.pd-layout .sp-mobile-menu,
  body.pd-layout .sp-sidebar-overlay {
    display: none;
  }
}
