:root {
    --primary: #6C63FF;
    --primary-dark: #584ee6;
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --radius: 16px;
    --border: #e5e7eb;
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Inter, system-ui, Arial;
    background: var(--bg);
    color: var(--text);
}


/* layout */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

@media(max-width:900px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr))
    }
}

@media(max-width:600px) {
    .grid {
        grid-template-columns: 1fr
    }
}


/* header */

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .2px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px
}

.link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600
}

.link:hover {
    color: var(--primary)
}


/* buttons */

.btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 8px 18px rgba(108, 99, 255, .25);
}

.btn:hover {
    background: var(--primary-dark)
}

.btn2 {
    background: #eef2ff;
    color: var(--primary);
    border: 1px solid #dcdafe;
    padding: 9px 14px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn2:hover {
    background: #e0e7ff
}

.btn-sm {
    padding: 9px 14px;
    border-radius: 12px
}


/* cards */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .06);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, .03);
}

.ad .thumb {
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: #eee;
}

.placeholder {
    background: linear-gradient(90deg, #eee, #f7f7f7, #eee);
}

.ad .p {
    padding: 14px
}

.title {
    font-size: 18px;
    font-weight: 800;
    margin: 0
}

.meta {
    color: var(--muted);
    font-size: 14px;
    margin: 6px 0
}

.price {
    font-size: 20px;
    font-weight: 900;
    margin: 10px 0 0 0
}


/* actions in card */

.actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.actions .btn,
.actions .btn2 {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: none;
}


/* form */

.input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 15px;
    background: #fff;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
}

.form {
    display: grid;
    gap: 12px
}

.lbl {
    font-size: 13px;
    color: var(--muted);
    font-weight: 700
}

.row2 {
    display: flex;
    gap: 12px
}

.row2>div {
    flex: 1
}

@media(max-width:600px) {
    .row2 {
        flex-direction: column
    }
}


/* badge */

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}


/* filter bar (ixcham) */

.filterbar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
}

.filterform {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.input-sm {
    width: auto;
    min-width: 220px;
    max-width: 320px;
    padding: 9px 12px;
    border-radius: 12px;
}

@media(max-width:600px) {
    .input-sm {
        min-width: 100%;
        max-width: 100%
    }
    .btn-sm {
        width: 100%
    }
}


/* alert */

.alert {
    padding: 10px;
    border: 1px solid #ffcccc;
    background: #fff5f5;
    border-radius: 12px;
    font-weight: 700;
}


/* ========================= MOBILE OPTIMIZATION ========================= */

@media (max-width: 600px) {
    .container {
        padding: 12px
    }
    /* Header: brand + tugmalar pastga tushsin */
    .row {
        align-items: flex-start
    }
    .topbar .row {
        flex-direction: column;
        gap: 10px;
    }
    .brand {
        font-size: 18px
    }
    .nav {
        width: 100%;
        justify-content: space-between;
    }
    .nav .btn {
        flex: 1;
        justify-content: center
    }
    .nav .btn,
    .nav .btn2 {
        padding: 10px 12px
    }
    /* Filter: bir qatordan chiqib ketmasin */
    .filterform {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .filterform .badge {
        align-self: flex-start
    }
    .input-sm {
        min-width: 100%;
        max-width: 100%
    }
    .btn-sm {
        width: 100%
    }
    /* Grid: 2 ustun (mobile) */
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    /* Card */
    .ad .thumb {
        height: 140px
    }
    .ad .p {
        padding: 12px
    }
    .title {
        font-size: 15px
    }
    .meta {
        font-size: 12px
    }
    .price {
        font-size: 16px
    }
    /* Actions: tugmalar mobile’da 2 qatorda, to‘liq joy olsin */
    .actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .actions a {
        justify-content: center;
        width: 100%;
        text-align: center;
    }
    .actions .btn,
    .actions .btn2 {
        padding: 9px 10px;
        font-size: 13px;
    }
}


/* Juda kichik ekran (<=380px) bo‘lsa 1 ustun */

@media (max-width: 380px) {
    .grid {
        grid-template-columns: 1fr
    }
    .ad .thumb {
        height: 170px
    }
}


/*/* ===== BOTTOM NAV DEFAULT (HIDDEN) ===== */

.bottom-nav-text {
    display: none;
}


/* ===== MOBILE ONLY ===== */

@media (max-width: 2000px) {
    body {
        padding-bottom: 80px;
    }
    /* tepada login/register yashiriladi */
    .topbar .nav {
        display: none;
    }
    .bottom-nav-text {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 64px;
        background: #0b0b0c;
        border-top: 1px solid rgba(255, 255, 255, .08);
        z-index: 99999;
    }
    .bottom-nav-text a {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: rgba(255, 255, 255, .7);
        font-size: 15px;
        font-weight: 800;
    }
    .bottom-nav-text a.active {
        color: #fff;
        background: rgba(255, 255, 255, .12);
        border-radius: 12px;
        margin: 6px;
    }
    .bottom-nav-text a.add {
        background: var(--primary);
        color: #fff;
        border-radius: 14px;
        margin: 6px;
    }
}