/* Nellai Online — mobile app experience */

:root {
  --app-tabbar-h: 64px;
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* PWA / mobile browser chrome */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body.site-shell {
  -webkit-tap-highlight-color: rgba(13, 143, 74, 0.12);
  touch-action: manipulation;
}

/* Bottom tab bar */
.app-tabbar {
  display: none;
}

@media (max-width: 768px) {
  body.site-shell:not(.auth-body) {
    padding-bottom: calc(var(--app-tabbar-h) + var(--app-safe-bottom) + 8px);
  }

  .app-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    height: calc(var(--app-tabbar-h) + var(--app-safe-bottom));
    padding: 6px 8px calc(6px + var(--app-safe-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.08);
    justify-content: space-around;
    align-items: flex-start;
    gap: 2px;
  }

  .app-tab {
    flex: 1;
    min-width: 0;
    max-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    text-decoration: none;
    color: #64748b;
    border-radius: 12px;
    transition: color 0.15s, background 0.15s, transform 0.12s;
    -webkit-tap-highlight-color: transparent;
  }

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

  .app-tab.is-active {
    color: var(--jd-green, #0d8f4a);
    background: rgba(13, 143, 74, 0.08);
  }

  .app-tab-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .app-tab-icon {
    width: 24px;
    height: 24px;
    position: relative;
    flex-shrink: 0;
  }

  .app-tab-icon::before,
  .app-tab-icon::after {
    content: '';
    position: absolute;
    box-sizing: border-box;
  }

  /* Home */
  .app-tab-icon-home::before {
    inset: 4px 5px 8px;
    border: 2px solid currentColor;
    border-radius: 3px 3px 2px 2px;
  }
  .app-tab-icon-home::after {
    width: 10px;
    height: 10px;
    left: 50%;
    top: 9px;
    transform: translateX(-50%) rotate(45deg);
    border-left: 2px solid currentColor;
    border-top: 2px solid currentColor;
    border-radius: 1px 0 0 0;
  }

  /* Search */
  .app-tab-icon-search::before {
    width: 13px;
    height: 13px;
    left: 4px;
    top: 4px;
    border: 2px solid currentColor;
    border-radius: 50%;
  }
  .app-tab-icon-search::after {
    width: 7px;
    height: 2px;
    right: 3px;
    bottom: 5px;
    background: currentColor;
    border-radius: 1px;
    transform: rotate(45deg);
  }

  /* Products */
  .app-tab-icon-products::before {
    inset: 5px 6px 7px;
    border: 2px solid currentColor;
    border-radius: 3px;
  }
  .app-tab-icon-products::after {
    width: 10px;
    height: 2px;
    left: 7px;
    top: 10px;
    background: currentColor;
    border-radius: 1px;
    box-shadow: 0 4px 0 currentColor;
  }

  /* List */
  .app-tab-icon-list::before {
    width: 14px;
    height: 2px;
    left: 5px;
    top: 7px;
    background: currentColor;
    border-radius: 1px;
    box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
  }
  .app-tab-icon-list::after {
    width: 4px;
    height: 4px;
    right: 5px;
    top: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
  }

  /* User */
  .app-tab-icon-user::before {
    width: 10px;
    height: 10px;
    left: 7px;
    top: 3px;
    border: 2px solid currentColor;
    border-radius: 50%;
  }
  .app-tab-icon-user::after {
    width: 16px;
    height: 8px;
    left: 4px;
    bottom: 3px;
    border: 2px solid currentColor;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
  }

  /* Compact app header */
  .site-header {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
  }

  .header-inner {
    padding: 10px 14px;
    min-height: 52px;
  }

  .logo {
    font-size: 1.25rem;
    max-width: calc(100% - 52px);
  }

  .logo.site-logo-has-img {
    max-width: calc(100% - 52px);
    max-height: 44px;
    overflow: hidden;
  }

  .site-header .site-logo-img,
  .site-logo-img {
    max-height: 44px !important;
    max-width: 100%;
  }

  .site-logo-img--footer {
    max-height: 50px;
    max-width: 200px;
  }

  .nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #f1f5f9;
  }

  /* Main content — app cards */
  body.site-shell {
    background: #f4f7f5;
  }

  .jd-hero {
    padding: 16px 12px 20px;
  }

  .jd-hero-brand {
    font-size: 1.15rem;
  }

  .jd-hero-title {
    font-size: 1.35rem;
  }

  .jd-hero-trust {
    font-size: 0.82rem;
  }

  .jd-hero-chip {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .jd-quick-nav {
    padding: 10px 0 12px;
  }

  .jd-quick-link em {
    display: none;
  }

  .jd-section-head {
    margin-bottom: 12px;
  }

  .jd-section-sub {
    font-size: 0.88rem;
  }

  .jd-search-bar {
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.09);
  }

  .jd-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .jd-search-location {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-width: 100%;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
  }

  .jd-search-query {
    flex: 0 0 auto !important;
    width: 100%;
  }

  .jd-search-query input {
    min-height: 48px;
    height: 48px;
    padding: 0 14px;
    font-size: 1rem;
    line-height: 48px;
  }

  .jd-search-actions {
    width: 100%;
  }

  .jd-search-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 0 0 13px 13px;
  }

  .jd-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .jd-top-row {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 20px;
  }

  .jd-advertise {
    padding: 22px 18px;
  }

  .jd-featured-cats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .jd-featured-card {
    padding: 16px;
    border-radius: 14px;
  }

  .jd-cat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .jd-cat-circle {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
  }

  .jd-cat-label {
    font-size: 0.78rem;
  }

  .jd-biz-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .jd-biz-card {
    padding: 14px;
    border-radius: 14px;
  }

  .jd-sponsored-card {
    flex: 0 0 min(260px, 82vw);
  }

  .jd-cta-strip {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 22px 18px;
  }

  .jd-cta-actions {
    justify-content: center;
  }

  /* Business / search cards */
  .biz-card,
  .jd-biz-card,
  .biz-product-card {
    border-radius: 14px;
  }

  .btn,
  .jd-search-btn,
  .jd-cta-btn,
  .jd-advertise-btn {
    min-height: 44px;
  }

  /* Footer — compact on mobile */
  .site-footer {
    margin-top: 24px;
    margin-bottom: 0;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
  }

  .footer-inner {
    padding: 28px 16px 20px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
    margin-bottom: 24px;
  }

  .footer-brand .footer-tagline {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }

  .footer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    text-align: left;
  }

  .footer-links li {
    margin: 0;
  }

  .footer-links a {
    display: block;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    font-size: 0.88rem;
  }

  .footer-bottom {
    padding-top: 16px;
  }

  /* Hide desktop float tabs — use bottom nav instead */
  .jd-float-tabs {
    display: none !important;
  }

  /* Listing / search page polish */
  .listing-page-hero,
  .search-hero {
    padding: 20px 14px;
  }

  .page-with-sidebar {
    grid-template-columns: 1fr;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* Auth pages: no tab bar padding */
  body.auth-body {
    padding-bottom: 0;
  }
}

@media (max-width: 400px) {
  .jd-cat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .app-tab-label {
    font-size: 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tab {
    transition: none;
  }
}
