/* ==========================================================================
   MOBILE PAGES (cart / wishlist / account / search)
   Extends css/mobile-category.css - load it AFTER that file.
   Same tokens as the category page:
     ink #111 · muted #666 · line #ECECEC · surface #F7F7F8
     accent #E07B39 (badges) · primary button #FDE8B0 · highlight #F7B928 / #FEE89D / #FDF7E8
   Strictly active on screen widths <= 768px
   ========================================================================== */

@media (max-width: 768px) {

    /* Desktop markup of these pages is hidden on phones (mobile layout takes over) */
    .vm-desktop-only {
        display: none !important;
    }

    /* overflow-x:hidden on the layout would stop position:sticky (top bar) from working */
    .vm-mobile-layout {
        overflow: visible;
        overflow-x: clip;
        background: #F7F7F8; /* top bar + meta section keep their own white */
    }

    /* Page body: grey surface so white cards read like the product grid */
    .vm-page-body {
        background: #F7F7F8;
        padding: 12px 10px 24px;
        min-height: 60vh;
    }

    .vm-page-body > * + * {
        margin-top: 12px;
    }

    /* --------------------------------------------------------------------
       Shared: buttons, alerts, toast, bottom tab bar
       -------------------------------------------------------------------- */
    .vm-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        height: 46px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 700;
        font-family: inherit;
        text-decoration: none;
        cursor: pointer;
        border: 1.5px solid transparent;
        transition: background-color .15s ease, color .15s ease;
    }

    .vm-btn-primary {
        background: #FDE8B0;
        color: #111111;
        box-shadow: 0 1px 4px rgba(253, 232, 176, 0.4);
    }
    .vm-btn-primary:active { background: #F5DC9A; }
    .vm-btn-primary:disabled { opacity: .5; }

    .vm-btn-outline {
        background: #ffffff;
        border-color: #111111;
        color: #111111;
    }
    .vm-btn-outline:active { background: #111111; color: #ffffff; }

    .vm-btn-danger {
        background: #ffffff;
        border-color: #C5221F;
        color: #C5221F;
    }
    .vm-btn-danger:active { background: #FCE8E6; }
    .vm-btn-danger:disabled { opacity: .4; }

    .vm-alert {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 11px 12px;
        border-radius: 10px;
        font-size: 12.5px;
        line-height: 1.45;
        background: #E6F4EA;
        color: #137333;
    }
    .vm-alert i { margin-top: 2px; }
    .vm-alert.error { background: #FCE8E6; color: #C5221F; }

    .vm-toast {
        position: fixed;
        left: 50%;
        bottom: 84px;
        transform: translate(-50%, 12px);
        max-width: calc(100vw - 32px);
        background: #111111;
        color: #ffffff;
        font-size: 12.5px;
        font-weight: 600;
        padding: 9px 16px;
        border-radius: 999px;
        z-index: 2200;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease, transform .2s ease;
    }
    .vm-toast.show { opacity: 1; transform: translate(-50%, 0); }
    .vm-toast.error { background: #C5221F; }

    /* Bottom tab bar (same chrome as the category toolbar) */
    .vm-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1050;
        display: flex;
        background: #ffffff;
        border-top: 1px solid #E5E5E5;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.07);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .vm-tab {
        position: relative;
        flex: 1;
        height: 54px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: #777777;
        font-size: 10.5px;
        font-weight: 600;
        text-decoration: none;
    }
    .vm-tab i { font-size: 17px; color: inherit; }
    .vm-tab.active { color: #111111; }
    .vm-tab.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        width: 28px;
        height: 3px;
        margin-left: -14px;
        background: #F7B928;
        border-radius: 0 0 3px 3px;
    }

    /* Space so content is never hidden under the fixed bars */
    .vm-bar-spacer { height: 24px; }

    /* --------------------------------------------------------------------
       Cart
       -------------------------------------------------------------------- */
    .vm-cart-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .vm-cart-item {
        position: relative;
        display: flex;
        gap: 12px;
        padding: 10px;
        background: #ffffff;
        border: 1px solid #ECECEC;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
        transition: opacity .3s ease;
    }

    .vm-cart-img {
        flex: 0 0 88px;
        width: 88px;
        height: 88px;
        border-radius: 10px;
        overflow: hidden;
        background: #F8F8F9;
        display: block;
    }
    .vm-cart-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

    .vm-cart-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
    }

    .vm-cart-name {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        padding-right: 30px;
        margin-bottom: 4px;
        font-size: 12.5px;
        line-height: 1.35;
        color: #262626;
        text-decoration: none;
    }

    .vm-cart-item .vm-card-price-row { margin-bottom: 0; }

    .vm-cart-remove {
        position: absolute;
        top: 4px;
        right: 4px;
        width: 34px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #777777;
        font-size: 14px;
        cursor: pointer;
    }
    .vm-cart-remove:active { color: #C5221F; }

    .vm-cart-bottom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-top: auto;
        padding-top: 8px;
    }

    .vm-qty {
        display: inline-flex;
        align-items: center;
        border: 1px solid #E2E2E2;
        border-radius: 8px;
        overflow: hidden;
        background: #ffffff;
    }

    .vm-qty button {
        width: 32px;
        height: 32px;
        background: #ffffff;
        border: none;
        font-size: 17px;
        line-height: 1;
        color: #111111;
        cursor: pointer;
    }
    .vm-qty button:active { background: #F4F4F6; }
    .vm-qty button:disabled { opacity: .4; }

    .vm-qty input {
        width: 38px;
        height: 32px;
        padding: 0;
        text-align: center;
        font-size: 13px;
        font-weight: 700;
        font-family: inherit;
        color: #111111;
        background: #ffffff;
        border: none;
        border-left: 1px solid #ECECEC;
        border-right: 1px solid #ECECEC;
        border-radius: 0;
        -moz-appearance: textfield;
        appearance: textfield;
    }
    .vm-qty input::-webkit-outer-spin-button,
    .vm-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

    .vm-cart-line-total {
        font-size: 14px;
        font-weight: 700;
        color: #111111;
    }

    .vm-summary-card {
        background: #ffffff;
        border: 1px solid #ECECEC;
        border-radius: 12px;
        padding: 14px;
    }
    .vm-summary-card h3 {
        margin: 0 0 10px;
        font-size: 14px;
        font-weight: 700;
        color: #111111;
    }
    .vm-summary-row {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        font-size: 13px;
        color: #444444;
    }
    .vm-summary-row .free { color: #00827A; font-weight: 600; }
    .vm-summary-row.total {
        margin-top: 6px;
        padding-top: 12px;
        border-top: 1px dashed #E2E2E2;
        font-size: 15px;
        font-weight: 700;
        color: #111111;
    }

    /* Sticky checkout bar */
    .vm-checkout-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1050;
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: #ffffff;
        border-top: 1px solid #E5E5E5;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.07);
    }
    .vm-checkout-total { flex: 0 0 auto; line-height: 1.2; }
    .vm-checkout-total small { display: block; font-size: 11px; color: #777777; }
    .vm-checkout-total strong { font-size: 17px; font-weight: 700; color: #111111; }
    .vm-checkout-bar .vm-btn { flex: 1; }

    /* --------------------------------------------------------------------
       Wishlist / Search
       -------------------------------------------------------------------- */
    .vm-products-section .vm-empty-state { margin-top: 4px; }
    .vm-empty-state .vm-reset-btn { margin-top: 2px; }

    .vm-note {
        padding: 10px 12px;
        border-radius: 10px;
        background: #FDF7E8;
        border: 1px solid #F0E9D6;
        font-size: 12.5px;
        line-height: 1.45;
        color: #5C4A2A;
        margin-bottom: 10px;
    }

    .vm-chips-row-wrap.vm-chips-static .vm-chips-scroll { padding-right: 14px; }
    .vm-filter-chip i { font-size: 10px; }

    .vm-search-sub {
        margin: 2px 0 0;
        font-size: 12.5px;
        color: #666666;
    }
    .vm-search-sub b { color: #111111; font-weight: 600; }

    /* --------------------------------------------------------------------
       Account
       -------------------------------------------------------------------- */
    .vm-profile-card {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 16px;
        background: #ffffff;
        border: 1px solid #ECECEC;
        border-radius: 16px;
    }
    .vm-avatar {
        flex: 0 0 56px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #FEE89D;
        color: #5C2E0B;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: Georgia, serif;
        font-size: 24px;
        font-weight: 700;
    }
    .vm-profile-text { min-width: 0; }
    .vm-profile-name {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        color: #111111;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .vm-profile-email, .vm-profile-user {
        margin: 2px 0 0;
        font-size: 12.5px;
        color: #666666;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .vm-profile-user { font-size: 11.5px; color: #888888; }

    .vm-quick-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .vm-quick-tile {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 14px 6px 12px;
        background: #ffffff;
        border: 1px solid #ECECEC;
        border-radius: 12px;
        color: #111111;
        font-size: 12px;
        font-weight: 600;
        text-decoration: none;
    }
    .vm-quick-tile:active { background: #FDF7E8; }
    .vm-quick-icon {
        position: relative;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: #FDF7E8;
        border: 1px solid #F0E9D6;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 17px;
        color: #222222;
    }

    .vm-list {
        background: #ffffff;
        border: 1px solid #ECECEC;
        border-radius: 12px;
        overflow: hidden;
    }
    .vm-list-row {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 13px 14px;
        background: #ffffff;
        border: none;
        border-bottom: 1px solid #F3F3F3;
        text-align: left;
        font-family: inherit;
        color: #111111;
        text-decoration: none;
        cursor: pointer;
    }
    .vm-list-row:last-child { border-bottom: none; }
    .vm-list-row:active { background: #F9F9FA; }
    .vm-list-icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #FDF7E8;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        color: #222222;
    }
    .vm-list-text { flex: 1; min-width: 0; }
    .vm-list-text strong { display: block; font-size: 14px; font-weight: 600; }
    .vm-list-text small { display: block; margin-top: 1px; font-size: 11.5px; color: #777777; }
    .vm-list-chevron { font-size: 11px; color: #AAAAAA; }
    .vm-list-row.danger { color: #C5221F; }
    .vm-list-row.danger .vm-list-icon { background: #FCE8E6; color: #C5221F; }

    /* Full-screen slide-up panels (same motion as the category menu) */
    .vm-panel {
        position: fixed;
        inset: 0;
        z-index: 1900;
        display: flex;
        flex-direction: column;
        background: #ffffff;
        transform: translateY(100%);
        visibility: hidden;
        pointer-events: none;
        transition: transform .38s cubic-bezier(.32, .72, 0, 1), visibility 0s linear .38s;
        will-change: transform;
    }
    .vm-panel.open {
        transform: translateY(0);
        visibility: visible;
        pointer-events: auto;
        transition: transform .38s cubic-bezier(.32, .72, 0, 1), visibility 0s;
    }
    .vm-panel-header {
        display: flex;
        align-items: center;
        gap: 18px;
        padding: 14px 16px;
        border-bottom: 1px solid #DDDDDD;
        background: #ffffff;
        flex-shrink: 0;
    }
    .vm-panel-back {
        background: none;
        border: 0;
        padding: 4px;
        font-size: 18px;
        color: #222222;
        cursor: pointer;
    }
    .vm-panel-title { margin: 0; font-size: 18px; font-weight: 700; color: #2B1D14; }
    .vm-panel-body {
        flex: 1;
        overflow-y: auto;
        padding: 16px 14px 24px;
        -webkit-overflow-scrolling: touch;
    }
    .vm-panel-desc { margin: 0 0 16px; font-size: 12.5px; line-height: 1.5; color: #666666; }
    .vm-panel-footer {
        flex-shrink: 0;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: #ffffff;
        border-top: 1px solid #ECECEC;
    }

    /* Form fields. 16px text stops iOS Safari from zooming on focus. */
    .vm-field { margin-bottom: 14px; }
    .vm-field label {
        display: block;
        margin-bottom: 6px;
        font-size: 12.5px;
        font-weight: 600;
        color: #333333;
    }
    .vm-field .req { color: #C5221F; }
    .vm-field input,
    .vm-field textarea {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 12px 14px;
        font-size: 16px;
        font-family: inherit;
        color: #111111;
        background: #ffffff;
        border: 1.5px solid #DCDCDC;
        border-radius: 10px;
        outline: none;
        transition: border-color .2s ease;
        -webkit-appearance: none;
        appearance: none;
    }
    .vm-field textarea { resize: none; line-height: 1.4; }
    .vm-field input:focus,
    .vm-field textarea:focus { border-color: #111111; }
    .vm-field input:disabled { background: #F5F5F7; color: #888888; }
    .vm-field small { display: block; margin-top: 5px; font-size: 11.5px; color: #888888; }
    .vm-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

    /* Privacy panel */
    .vm-notice {
        padding: 14px;
        margin-bottom: 16px;
        background: #FDF7E8;
        border: 1px solid #F0E9D6;
        border-radius: 12px;
        font-size: 12.5px;
        line-height: 1.55;
        color: #4A3B22;
    }
    .vm-notice h4 { margin: 0 0 8px; font-size: 13.5px; font-weight: 700; color: #111111; }
    .vm-notice p { margin: 0 0 8px; }
    .vm-notice ul { margin: 0; padding-left: 18px; }
    .vm-notice li { margin-bottom: 6px; }

    .vm-section-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: #111111; }
    .vm-status {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
        font-size: 12.5px;
        line-height: 1.5;
        background: #E6F4EA;
        color: #137333;
    }
    .vm-status.warning { background: #FEF7E0; color: #8A5A00; }
    .vm-status.danger { background: #FCE8E6; color: #C5221F; }
    .vm-status a { color: inherit; text-decoration: underline; }
    .vm-danger-desc { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: #777777; }

    /* Delete confirmation reuses .vm-modal-overlay + .vm-sort-bottom-sheet from the category CSS */
    .vm-sheet-scroll { max-height: 88vh; overflow-y: auto; }
    .vm-sheet-body { padding-top: 14px; font-size: 13px; line-height: 1.5; color: #333333; }
    .vm-sheet-body p { margin: 0 0 10px; }
    .vm-sheet-body ul { margin: 0 0 12px; padding-left: 18px; }
    .vm-sheet-body li { margin-bottom: 6px; }
    .vm-sheet-warning {
        padding: 10px 12px;
        border-radius: 10px;
        background: #FCE8E6;
        color: #C5221F;
    }
    .vm-consent {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
        border-radius: 10px;
        background: #F7F7F8;
        font-size: 12.5px;
    }
    .vm-consent input { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: #111111; }
    .vm-sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
    .vm-sheet-actions .vm-btn,
    .vm-sheet-actions form { flex: 1; }
    .vm-sheet-actions form .vm-btn { width: 100%; }

    /* Same "closed overlays never peek in" fix as the category page */
    .vm-modal-overlay:not(.open) { visibility: hidden !important; pointer-events: none !important; }
}