/* =====================================================
   PABLE — App Chrome
   All app-first UI: bottom nav, bottom sheet, skeleton,
   icon scale, install prompt, micro-interactions
   ===================================================== */

/* ── Icon Size Scale ─────────────────────────────── */
.icon-sm {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.icon-md {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.icon-lg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.icon-xl {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.icon-2xl {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

svg.icon {
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Touch Targets ───────────────────────────────── */
.touch-target {
    min-height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Body with bottom nav ────────────────────────── */
body.has-bottom-nav {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

/* ── App Bottom Tab Bar ──────────────────────────── */
.app-bottom-nav {
    display: none;
    /* Hidden on desktop */
}

@media (max-width: 768px) {
    .app-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        padding-bottom: env(safe-area-inset-bottom);
        background: #fff;
        border-top: 1px solid #EBEBEB;
        z-index: 1000;
        align-items: stretch;
        justify-content: space-around;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    }

    .app-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        flex: 1;
        color: #717171;
        font-size: 10px;
        font-weight: 500;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
        transition: color 150ms ease;
        padding: 8px 4px;
        min-height: 48px;
    }

    .app-bottom-nav a svg {
        stroke: currentColor;
    }

    .app-bottom-nav a.active,
    .app-bottom-nav a:hover {
        color: #FF385C;
    }

    .app-bottom-nav a .tab-label {
        line-height: 1;
    }
}

/* ── Sticky App Search Bar (mobile) ─────────────── */
.app-search-bar {
    display: none;
}

@media (max-width: 768px) {
    .app-search-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        position: sticky;
        top: 0;
        z-index: 200;
        background: #fff;
        padding: 10px 16px;
        border-bottom: 1px solid #EBEBEB;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .app-search-bar input {
        flex: 1;
        height: 40px;
        border: 1.5px solid #DDDDDD;
        border-radius: 20px;
        padding: 0 14px;
        font-size: 14px;
        outline: none;
        background: #F7F7F7;
        transition: border-color 150ms ease, background 150ms ease;
    }

    .app-search-bar input:focus {
        border-color: #FF385C;
        background: #fff;
    }

    .app-filter-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 40px;
        padding: 0 14px;
        border: 1.5px solid #DDDDDD;
        border-radius: 20px;
        background: #fff;
        font-size: 13px;
        font-weight: 600;
        color: #222;
        cursor: pointer;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
        transition: border-color 150ms, background 150ms;
    }

    .app-filter-btn.has-filters {
        border-color: #FF385C;
        background: #FFF0F2;
        color: #FF385C;
    }

    .app-filter-btn svg {
        stroke: currentColor;
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
}

/* ── Bottom Sheet ────────────────────────────────── */
.bottom-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 900;
    opacity: 0;
    transition: opacity 250ms ease;
}

.bottom-sheet-overlay.open {
    display: block;
    opacity: 1;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    z-index: 950;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
}

.bottom-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #DDDDDD;
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #EBEBEB;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.bottom-sheet-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: #222;
}

.bottom-sheet-close {
    width: 32px;
    height: 32px;
    background: #F7F7F7;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #484848;
    -webkit-tap-highlight-color: transparent;
}

.bottom-sheet-body {
    padding: 20px;
}

.bottom-sheet-footer {
    padding: 16px 20px;
    border-top: 1px solid #EBEBEB;
    position: sticky;
    bottom: 0;
    background: #fff;
    display: flex;
    gap: 10px;
}

.bottom-sheet-footer .btn-primary {
    flex: 1;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    font-size: 15px;
}

.bottom-sheet-footer .btn-secondary {
    height: 48px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    font-size: 15px;
}

/* ── Skeleton Loading ────────────────────────────── */
@keyframes skeleton-shimmer {
    0% {
        background-position: -400px 0;
    }

    100% {
        background-position: 400px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #F0F0F0 25%, #E8E8E8 50%, #F0F0F0 75%);
    background-size: 800px 100%;
    animation: skeleton-shimmer 1.4s infinite linear;
    border-radius: 8px;
}

.skeleton-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #EBEBEB;
    overflow: hidden;
}

.skeleton-card .sk-img {
    width: 100%;
    aspect-ratio: 4/3;
}

.skeleton-card .sk-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-card .sk-title {
    height: 16px;
    width: 70%;
}

.skeleton-card .sk-sub {
    height: 13px;
    width: 45%;
}

.skeleton-card .sk-price {
    height: 18px;
    width: 35%;
    margin-top: 4px;
}

/* ── PWA Install Prompt ──────────────────────────── */
@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

#pwa-install-prompt {
    animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Save / Heart Micro-interaction ─────────────── */
.save-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 150ms;
    -webkit-tap-highlight-color: transparent;
    color: #717171;
}

.save-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.save-btn.saved {
    color: #FF385C;
}

.save-btn svg {
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
    stroke: currentColor;
}

.save-btn.saving svg {
    transform: scale(1.35);
}

.save-btn.saved svg {
    fill: #FF385C;
}

/* ── Filter Chip Pills ───────────────────────────── */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1.5px solid #DDDDDD;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #484848;
    background: #fff;
    cursor: pointer;
    transition: all 150ms;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
    border-color: #FF385C;
    background: #FFF0F2;
    color: #FF385C;
}

/* ── Search input focus ring ─────────────────────── */
.filter-input:focus {
    outline: none;
    border-color: #FF385C !important;
    box-shadow: 0 0 0 3px rgba(255, 56, 92, 0.12);
}

/* ── Active states for buttons ───────────────────── */
.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary:active {
    transform: scale(0.97);
}

/* ── Category icon grid (search page) ───────────── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.category-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1.5px solid #EBEBEB;
    border-radius: 12px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #484848;
    cursor: pointer;
    transition: all 150ms;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.category-tile svg {
    stroke: #717171;
    transition: stroke 150ms;
}

.category-tile:hover,
.category-tile.active {
    border-color: #FF385C;
    background: #FFF0F2;
    color: #FF385C;
}

.category-tile:hover svg,
.category-tile.active svg {
    stroke: #FF385C;
}