﻿/* =========================================================
   MOBILE / TABLET: slide-in drawer + bottom navigation + cart badge
   (guest aur logged-in dono ke liye). layout.css ke baad load hota hai.
   ========================================================= */

/* ---------- cart badge (header + bottom nav) ---------- */
.fn-actions .fn-cart {
    position: relative;
}

.fn-badge {
    position: absolute;
    top: 0;
    right: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    background: #ef4444;
    color: #fff;
    font-size: .66rem;
    font-weight: 800;
    font-style: normal;
    line-height: 1;
    box-shadow: 0 0 0 2px #fff;
}

    .fn-badge[hidden] {
        display: none;
    }

/* ---------- drawer ---------- */
body.fn-lock {
    overflow: hidden;
}

.fn-drawer-bg {
    position: fixed;
    inset: 0;
    z-index: 1290;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility 0s linear .25s;
}

    .fn-drawer-bg.open {
        opacity: 1;
        visibility: visible;
        transition-delay: 0s;
    }

.fn-drawer {
    position: fixed;
    z-index: 1300;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 340px);
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 0 40px rgba(15, 23, 42, .3);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform .28s ease, visibility 0s linear .28s;
    outline: 0;
}

    .fn-drawer.open {
        transform: none;
        visibility: visible;
        transition-delay: 0s;
    }

.fn-dr-head {
    position: relative;
    padding: 14px 14px 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--fn-primary, #4f46e5), #7c3aed);
}

    .fn-dr-head.is-auth {
        display: flex;
        align-items: center;
        gap: 12px;
        padding-right: 52px;
    }

.fn-dr-x {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    font-size: .95rem;
    cursor: pointer;
}

    .fn-dr-x:hover {
        background: rgba(255, 255, 255, .32);
    }

.fn-dr-head .fn-avatar-lg {
    flex: none;
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.fn-dr-who {
    min-width: 0;
    padding-right: 40px;
}

.fn-dr-head.is-auth .fn-dr-who {
    padding-right: 0;
}

.fn-dr-who b {
    display: block;
    font-size: 1.02rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fn-dr-who small {
    display: block;
    margin-top: 2px;
    font-size: .78rem;
    line-height: 1.4;
    opacity: .9;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fn-dr-head.is-auth .fn-dr-who small {
    white-space: nowrap;
}

.fn-dr-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fff;
    color: var(--fn-primary, #4f46e5) !important;
    font-size: .9rem;
    font-weight: 800;
    text-decoration: none;
}

.fn-dr-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 10px 14px;
}

    .fn-dr-body h4 {
        margin: 12px 4px 4px;
        font-size: .7rem;
        font-weight: 800;
        letter-spacing: .07em;
        text-transform: uppercase;
        color: var(--fn-muted, #64748b);
    }

.fn-dr-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 2px;
}

    .fn-dr-tiles a {
        display: grid;
        justify-items: center;
        gap: 4px;
        padding: 10px 4px;
        border: 1px solid var(--fn-line, #e2e8f0);
        border-radius: 12px;
        background: #f8fafc;
        color: var(--fn-ink, #0f172a);
        font-size: .74rem;
        font-weight: 700;
        text-decoration: none;
    }

        .fn-dr-tiles a i {
            font-size: 1.05rem;
            color: var(--fn-primary, #4f46e5);
        }

        .fn-dr-tiles a:active {
            background: #eef2ff;
        }

.fn-dr-list {
    display: grid;
    gap: 1px;
}

    .fn-dr-list a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 10px;
        border-radius: 10px;
        color: var(--fn-ink, #0f172a);
        font-size: .9rem;
        font-weight: 600;
        text-decoration: none;
        transition: background .15s, color .15s;
    }

        .fn-dr-list a i {
            width: 20px;
            text-align: center;
            font-size: .92rem;
            color: var(--fn-muted, #64748b);
        }

        .fn-dr-list a:active, .fn-dr-list a:hover {
            background: #eef2ff;
            color: var(--fn-primary, #4f46e5);
        }

        .fn-dr-list a.active {
            background: #eef2ff;
            color: var(--fn-primary, #4f46e5);
        }

            .fn-dr-list a.active i {
                color: var(--fn-primary, #4f46e5);
            }

.fn-dr-seller {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px dashed #c7d2fe;
    border-radius: 12px;
    background: #f5f3ff;
    color: var(--fn-ink, #0f172a);
    text-decoration: none;
}

    .fn-dr-seller > i:first-child {
        width: 36px;
        height: 36px;
        display: grid;
        place-items: center;
        border-radius: 10px;
        background: var(--fn-primary, #4f46e5);
        color: #fff;
    }

    .fn-dr-seller > span {
        flex: 1;
        min-width: 0;
    }

    .fn-dr-seller b {
        display: block;
        font-size: .88rem;
    }

    .fn-dr-seller small {
        display: block;
        font-size: .72rem;
        color: var(--fn-muted, #64748b);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fn-dr-seller > i:last-child {
        font-size: .7rem;
        color: #94a3b8;
    }

.fn-dr-foot {
    margin: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--fn-line, #e2e8f0);
    background: #fff;
}

    .fn-dr-foot button {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 11px;
        border: 1px solid #fecaca;
        border-radius: 10px;
        background: #fef2f2;
        color: #dc2626;
        font: inherit;
        font-size: .9rem;
        font-weight: 800;
        cursor: pointer;
    }

/* desktop (>=992px): wahi drawer, par user button ke neeche right side se khulta hai */
@media (min-width: 992px) {
    .fn-drawer {
        left: auto;
        right: 0;
        width: 360px;
        transform: translateX(102%);
    }

        .fn-drawer.open {
            transform: none;
        }
}

/* ---------- bottom navigation (phones) ---------- */
.fn-bnav {
    display: none;
}

@media (max-width: 767px) {
    /* header ka cart ab bottom nav me hai */
    .fn-actions .fn-cart {
        display: none;
    }

    .fn-bnav {
        position: fixed;
        z-index: 1050;
        left: 0;
        right: 0;
        bottom: 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: #fff;
        border-top: 1px solid var(--fn-line, #e2e8f0);
        box-shadow: 0 -6px 20px rgba(15, 23, 42, .08);
        padding-bottom: env(safe-area-inset-bottom);
    }

        .fn-bnav a {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 3px;
            min-height: 56px;
            padding: 6px 2px;
            color: var(--fn-muted, #64748b);
            font-size: .66rem;
            font-weight: 700;
            text-decoration: none;
            -webkit-tap-highlight-color: transparent;
        }

            .fn-bnav a i {
                font-size: 1.15rem;
            }

            .fn-bnav a.active {
                color: var(--fn-primary, #4f46e5);
            }

                .fn-bnav a.active::before {
                    content: "";
                    position: absolute;
                    top: 0;
                    left: 28%;
                    right: 28%;
                    height: 3px;
                    border-radius: 0 0 4px 4px;
                    background: var(--fn-primary, #4f46e5);
                }

            .fn-bnav a:active {
                background: #f1f5f9;
            }

        .fn-bnav .fn-badge {
            top: 4px;
            right: calc(50% - 20px);
            box-shadow: 0 0 0 2px #fff;
        }

    /* content bottom nav ke neeche na chhupe */
    body.has-bnav {
        padding-bottom: calc(58px + env(safe-area-inset-bottom));
    }

        body.has-bnav .fn-top {
            bottom: calc(70px + env(safe-area-inset-bottom));
        }
}

@media (prefers-reduced-motion: reduce) {
    .fn-drawer, .fn-drawer-bg {
        transition: none;
    }
}

/* header user menu: current page */
.fn-actions .fn-menu a.active {
    background: #eef2ff;
    color: var(--fn-primary, #4f46e5);
}
