/*!
 * Linkorae Mobile-First "Jobs-Style" Layer
 * ========================================
 * Single-hand operation · touch-first · 3 colors · ≤2 primary buttons · ≤150ms animations.
 *
 * Scope: ONLY applies when (max-width: 768px) AND body has .lk-v2-page (marketing pages).
 *        Desktop (>=768px) is untouched.
 *
 * Tokens (locked):
 *   --lkm-orange : #FF7A00
 *   --lkm-bg     : #FFFFFF
 *   --lkm-ink    : #333333
 *   --lkm-mute   : #999999
 *   --lkm-spacer : 16px
 */

:root {
  --lkm-orange:      #FF7A00;
  --lkm-orange-dark: #E56A00;
  --lkm-bg:          #FFFFFF;
  --lkm-ink:         #333333;
  --lkm-mute:        #999999;
  --lkm-line:        #EEEEEE;
  --lkm-tap:         48px;
  --lkm-space:       16px;
  --lkm-radius:      12px;
  --lkm-shadow:      0 2px 12px rgba(0,0,0,0.06);
  --lkm-anim:        150ms;
}

/* ============================================================
 * 0. Global — GPU acceleration & smooth scroll on mobile
 * ============================================================ */
@media (max-width: 768px) {
  html, body {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  body.lk-v2-page {
    font-size: 16px;
    color: var(--lkm-ink);
    background: var(--lkm-bg);
  }
  /* Prevent iOS tap highlight flicker */
  button, a, .lk-pick-opt, .lk-btn, .lkm-tab, .lkm-bnav a, .lkm-chip {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

/* ============================================================
 * 1. Touch feedback — applied globally on mobile to common tappables
 *    Uses transform+opacity only (GPU). ≤150ms.
 * ============================================================ */
@media (max-width: 768px) {
  .lk-btn,
  .lk-pick-opt,
  .lkm-tab,
  .lkm-bnav a,
  .lkm-chip,
  .lkm-card,
  .lk-input,
  .lk-select {
    transition: transform var(--lkm-anim) ease,
                opacity   var(--lkm-anim) ease,
                box-shadow var(--lkm-anim) ease,
                background var(--lkm-anim) ease;
    will-change: transform;
  }
  .lk-btn:active,
  .lk-pick-opt:active,
  .lkm-tab:active,
  .lkm-bnav a:active,
  .lkm-chip:active,
  .lkm-card:active {
    transform: scale(0.96) translateZ(0);
    opacity: 0.92;
  }
  .lk-btn[disabled],
  .lkm-tab[aria-disabled="true"],
  .is-loading {
    pointer-events: none;
    opacity: 0.55;
  }
}

/* ============================================================
 * 2. Large tappable targets (≥48×48)
 * ============================================================ */
@media (max-width: 768px) {
  .lk-btn {
    min-height: 52px;
    border-radius: var(--lkm-radius);
    font-size: 17px;
    font-weight: 700;
    padding: 14px 20px;
  }
  .lk-input, .lk-select {
    min-height: 48px;
    font-size: 16px;      /* prevents iOS auto-zoom on focus */
    border-radius: 10px;
    padding: 12px 14px;
    /* Keyboard-safe focus scroll */
    scroll-margin-top: 80px;
    scroll-margin-bottom: 120px;
  }
  .lk-pick-opt {
    min-height: 88px;
    border-radius: 12px;
  }
}

/* ============================================================
 * 3. Inline volumetric-weight helper (mobile only)
 *    Shown directly under the weight input with real-time calc.
 * ============================================================ */
.lkm-volhint {
  display: none;
}
@media (max-width: 768px) {
  .lkm-volhint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 12px;
    background: #FFF6EE;
    border: 1px solid #FFD6B0;
    border-radius: 10px;
    font-size: 13px;
    color: var(--lkm-ink);
    line-height: 1.4;
  }
  .lkm-volhint__icon {
    flex: 0 0 auto;
    font-size: 16px;
  }
  .lkm-volhint__body {
    flex: 1 1 auto;
  }
  .lkm-volhint__row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  .lkm-volhint__row b {
    color: var(--lkm-orange);
    font-weight: 700;
  }
  .lkm-volhint__formula {
    margin-top: 2px;
    color: var(--lkm-mute);
    font-size: 12px;
  }
}

/* ============================================================
 * 4. Dual-lane ETA badge (mobile only)
 *    Small row shown under the Shipping Speed select.
 * ============================================================ */
.lkm-lane-eta {
  display: none;
}
@media (max-width: 768px) {
  .lkm-lane-eta {
    display: flex;
    gap: 8px;
    margin-top: 8px;
  }
  .lkm-lane-eta__pill {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: #F8FAFC;
    border: 1px solid var(--lkm-line);
    border-radius: 10px;
    font-size: 13px;
    color: var(--lkm-ink);
    font-weight: 600;
  }
  .lkm-lane-eta__pill[data-active="true"] {
    background: #FFF6EE;
    border-color: #FFD6B0;
    color: var(--lkm-orange-dark);
  }
}

/* ============================================================
 * 5. Sensitive-goods guarantee chip (mobile only)
 *    Shown when cargo is cosmetics / lithium / specialty.
 * ============================================================ */
.lkm-chip-sensitive {
  display: none;
}
@media (max-width: 768px) {
  .lkm-chip-sensitive {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #FF7A00 0%, #FFA043 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(255,122,0,0.25);
  }
  .lkm-chip-sensitive__icon { font-size: 14px; }
}

/* ============================================================
 * 6. Sticky bottom CTA on quote page (mobile only)
 *    Always visible; pushes body up via spacer so content isn't hidden.
 * ============================================================ */
.lkm-sticky-cta {
  display: none;
}
@media (max-width: 768px) {
  body.lkm-has-sticky-cta {
    /* Extra room so last card isn't hidden by sticky CTA + bottom nav */
    padding-bottom: 170px !important;
  }
  .lkm-sticky-cta {
    display: block;
    position: fixed;
    left: 0; right: 0;
    bottom: 56px;                /* above bottom nav */
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,0.98);
    border-top: 1px solid var(--lkm-line);
    backdrop-filter: saturate(1.2) blur(8px);
    -webkit-backdrop-filter: saturate(1.2) blur(8px);
    z-index: 40;
  }
  body:not(.lkm-has-bnav) .lkm-sticky-cta {
    bottom: 0;                    /* if no bottom nav on this page */
  }
  .lkm-sticky-cta .lk-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--lkm-orange) 0%, #FFA043 100%);
    color: #fff;
    border: 0;
    box-shadow: 0 6px 20px rgba(255,122,0,0.35);
  }
  .lkm-sticky-cta__hint {
    text-align: center;
    font-size: 11px;
    color: var(--lkm-mute);
    margin-top: 6px;
  }
}

/* ============================================================
 * 7. Bottom tab bar (mobile only) — 3-item Jobs layout
 *    Replaces existing 4-item .lk-bnav via id=#lkmBottomNav
 * ============================================================ */
.lkm-bnav {
  display: none;
}
@media (max-width: 768px) {
  body.lkm-has-bnav {
    padding-bottom: 72px;         /* safe default if no sticky CTA */
  }
  .lkm-bnav {
    display: flex;
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid var(--lkm-line);
    z-index: 45;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
  }
  .lkm-bnav a {
    flex: 1 1 33.333%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--lkm-mute);
    font-size: 11px;
    font-weight: 600;
    position: relative;
  }
  .lkm-bnav a .lkm-bnav__ic {
    font-size: 20px;
    line-height: 1;
  }
  .lkm-bnav a.is-active {
    color: var(--lkm-orange);
  }
  /* Center item (Quote) — prominent */
  .lkm-bnav a.lkm-bnav__center {
    position: relative;
  }
  .lkm-bnav a.lkm-bnav__center .lkm-bnav__ic {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--lkm-orange) 0%, #FFA043 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(255,122,0,0.4);
    margin-top: -18px;
  }
  .lkm-bnav a.lkm-bnav__center {
    color: var(--lkm-orange);
  }
}

/* ============================================================
 * 8. Photo strip (real logistics photos) — quote page, mobile only
 * ============================================================ */
.lkm-photostrip {
  display: none;
}
@media (max-width: 768px) {
  .lkm-photostrip {
    display: block;
    margin: 24px -16px 8px;         /* break out of container padding */
    padding: 16px 16px 8px;
    background: #F8FAFC;
  }
  .lkm-photostrip__title {
    font-size: 14px;
    color: var(--lkm-mute);
    margin: 0 0 10px;
    text-align: center;
    font-weight: 600;
  }
  .lkm-photostrip__grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .lkm-photostrip__item {
    position: relative;
    display: block;
    width: 100%;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: #E5E7EB;
    cursor: pointer;
    box-shadow: var(--lkm-shadow);
  }
  .lkm-photostrip__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 300ms ease;
  }
  .lkm-photostrip__item:active img { transform: scale(0.98); }
  .lkm-photostrip__caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 20px 14px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
  }
}

/* ============================================================
 * 9. Fullscreen image viewer (simple, tap-to-close)
 * ============================================================ */
.lkm-viewer {
  display: none;
}
.lkm-viewer.is-open {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.95);
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: lkm-fade 180ms ease;
}
@keyframes lkm-fade { from { opacity: 0 } to { opacity: 1 } }
.lkm-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}
.lkm-viewer__close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 0;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ============================================================
 * 10. My Orders — 3-tab segmented control (mobile only)
 * ============================================================ */
.lkm-segtabs {
  display: none;
}
@media (max-width: 768px) {
  .lkm-segtabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: #F1F5F9;
    border-radius: 10px;
  }
  .lkm-segtabs button {
    flex: 1 1 33.333%;
    min-height: 40px;
    border: 0;
    background: transparent;
    color: var(--lkm-mute);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
  }
  .lkm-segtabs button[aria-selected="true"] {
    background: #fff;
    color: var(--lkm-ink);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  }
}

/* ============================================================
 * 11. Loading spinner (orange pulse, 40px) — mobile
 * ============================================================ */
.lkm-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,122,0,0.2);
  border-top-color: var(--lkm-orange);
  border-radius: 50%;
  animation: lkm-spin 800ms linear infinite;
}
@keyframes lkm-spin { to { transform: rotate(360deg); } }

/* ============================================================
 * 12. Hide desktop-only elements that clutter on mobile
 * ============================================================ */
@media (max-width: 768px) {
  /* If page still has an older .lk-bnav from legacy nav, hide it in favor of .lkm-bnav */
  body.lkm-has-bnav .lk-bnav { display: none !important; }
}