:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    padding-bottom: 70px;
}

@media (min-width: 769px) {
    body { padding-bottom: 0; }
}

a { text-decoration: none; color: inherit; }

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ================= HEADER ================= */
.main-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo a {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span { color: var(--primary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
    list-style: none;
}

.nav-links a {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
}

.nav-links a.active, .nav-links a:hover { color: var(--primary); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn {
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover { background: #f1f5f9; }

/* ================= SEARCH & CONTROLS ================= */
.store-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin: 30px 0 25px 0;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 260px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #ffffff;
    font-size: 14px;
    outline: none;
}

.search-box input:focus { border-color: var(--primary); }

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-select {
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #ffffff;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    color: var(--text-main);
}

/* ================= PRODUCT GRID & CARDS ================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.product-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

/* RASMLAR CHIQIB KETMASLIGI UCHUN QAT'IY O'LCHAM */
.product-thumb {
    position: relative;
    width: 100%;
    height: 190px;
    background: #e2e8f0;
    overflow: hidden;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Rasmni cho'zmasdan proporsional kesadi */
    display: block;
}

.badge-sale {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}

.product-category {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    color: #ffffff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
}

.product-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-title a:hover { color: var(--primary); }

.product-desc {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.author-info {
    font-size: 13px;
    color: var(--text-muted);
}

.author-info span { font-weight: 600; color: var(--text-main); }

.product-pricing {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-old {
    color: var(--text-muted);
    text-decoration: line-through;
    font-size: 13px;
}

.price-current {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

.price-free {
    font-size: 15px;
    font-weight: 800;
    color: #10b981;
}

/* ================= PAGINATION ================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0;
}

.page-link {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
}

.page-link:hover, .page-link.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* ================= MOBILE BOTTOM APP MENU ================= */
.mobile-app-menu { display: none; }

@media (max-width: 768px) {
    .nav-links, .header-actions .btn-outline { display: none; }

    .mobile-app-menu {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: #ffffff;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
        z-index: 9999;
    }

    .app-menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 500;
        color: var(--text-muted);
        gap: 4px;
        width: 20%;
    }

    .app-menu-item.active { color: var(--primary); }
    .app-menu-item svg { width: 20px; height: 20px; }
    .app-menu-item.sell-btn { color: var(--primary); font-weight: 700; }
}

/* ================= FOTER DIZAYNI ================= */
.main-footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 50px 0 20px 0;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-main);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul a {
    color: var(--text-muted);
    font-size: 13px;
    transition: color 0.2s;
}

.footer-col ul a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ================= MAHSULOTNING ICHKI SAHIFASI (SINGLE PRODUCT) ================= */
.product-single {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 35px;
    margin: 40px auto;
}

.product-main-view {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    padding: 25px;
}

.product-main-img {
    width: 100%;
    max-height: 420px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 25px;
    background: #f1f5f9;
}

.product-main-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-single-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.checkout-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.checkout-price-box {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 20px;
}

.spec-list {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    font-size: 13px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: var(--text-muted);
}

.spec-item strong {
    color: var(--text-main);
}

@media (max-width: 850px) {
    .product-single {
        grid-template-columns: 1fr;
    }
}