* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --border: #e6e9f2;
    --text: #1c2340;
    --muted: #6b7394;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 16px;
}

body {
    font-family: "Segoe UI", Tahoma, Vazirmatn, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

.container { max-width: 1150px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    gap: 20px;
}
.logo { font-weight: 900; font-size: 20px; color: var(--primary); text-decoration: none; }
.nav { display: flex; gap: 24px; }
.nav a { color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600; }
.nav a:hover { color: var(--primary); }
.cart-btn {
    position: relative;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-btn:hover { background: var(--primary-dark); }
.cart-count {
    background: var(--accent);
    border-radius: 999px;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, #4f46e5, #7c3aed 55%, #9333ea);
    color: #fff;
    text-align: center;
    padding: 70px 20px;
}
.hero h1 { font-size: 34px; margin-bottom: 12px; }
.hero p { font-size: 17px; opacity: 0.9; margin-bottom: 26px; }
.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #1c2340;
    font-weight: 800;
    padding: 13px 28px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    text-decoration: none;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-block { width: 100%; display: block; text-align: center; }

/* ---------- Products ---------- */
#products { padding-top: 40px; }
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 26px;
}
.filter-chip {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
    padding-bottom: 50px;
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(76, 71, 229, 0.12); }
.card-head {
    position: relative;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    background: linear-gradient(135deg, #eef1ff, #f7f3ff);
    text-decoration: none;
    color: inherit;
}
.p-title-link { color: var(--text); text-decoration: none; }
.p-title-link:hover { color: var(--primary); }
.p-title-link::after { content: ''; position: absolute; inset: 0; z-index: 2; }
.card-emoji { line-height: 1; }

/* ---------- Product page ---------- */
.product-section { padding-top: 28px; padding-bottom: 10px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); }
.p-detail {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 34px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 26px;
}
.p-gallery { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.p-thumbs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.p-thumbs img {
    width: 62px; height: 62px; object-fit: cover; border-radius: 10px;
    border: 2px solid transparent; cursor: pointer; opacity: 0.75;
}
.p-thumbs img.active { border-color: var(--primary); opacity: 1; }
.p-big {
    width: 100%;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 130px;
    background: linear-gradient(135deg, #eef1ff, #f7f3ff);
    border-radius: var(--radius);
}
.p-big img { width: 100%; max-height: 380px; object-fit: contain; border-radius: var(--radius); }
.card-head img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover;
}
.p-info-box h1 { font-size: 26px; margin-bottom: 6px; }
.p-cat { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.p-desc { font-size: 15px; color: #4c5578; margin-bottom: 18px; white-space: pre-wrap; line-height: 2; }
.loading-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 60px 24px; text-align: center; color: var(--muted); font-size: 15px; }
.p-badges { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.p-badges .badge { position: static; }
.p-price-big { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.p-price-big .price { font-size: 28px; color: var(--primary); font-weight: 900; }
.p-price-big .old-price { font-size: 16px; }
.p-stock-line { font-size: 14px; font-weight: 700; margin-bottom: 20px; }
.p-buy { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.p-qty {
    display: flex; align-items: center; gap: 6px;
    border: 1px solid var(--border); border-radius: 12px; padding: 4px;
}
.p-qty button {
    width: 38px; height: 38px; border: none; border-radius: 9px;
    background: var(--bg); cursor: pointer; font-size: 18px; font-weight: 800;
}
.p-qty button:disabled { opacity: 0.4; cursor: not-allowed; }
.p-qty span { min-width: 36px; text-align: center; font-weight: 900; font-size: 16px; }
.p-add { padding: 13px 36px; font-size: 16px; }
.p-features-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 34px;
}
.p-features-box h2 { font-size: 18px; margin-bottom: 12px; }
.p-features-box ul { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.p-features-box li { font-size: 14px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.p-features-box li::before { content: "✓ "; color: var(--success); font-weight: 800; }
.related-title { margin: 6px 0 18px; font-size: 20px; }
.related-title::after { content: ""; display: block; width: 44px; height: 4px; background: var(--primary); border-radius: 4px; margin-top: 6px; }

@media (max-width: 640px) {
    .p-detail { grid-template-columns: 1fr; padding: 18px; }
    .p-big { min-height: 200px; font-size: 90px; }
    .p-features-box ul { grid-template-columns: 1fr; }
}
.badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--danger);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 999px;
}
.badge.warn { background: var(--accent); color: #1c2340; }
.card-body { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 17px; margin-bottom: 6px; }
.card-body .cat { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.card-body .desc { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.features { list-style: none; margin-bottom: 14px; flex: 1; }
.features li { font-size: 13px; color: var(--text); padding: 3px 0; }
.features li::before { content: "✓ "; color: var(--success); font-weight: 800; }
.price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.price { font-size: 19px; font-weight: 900; color: var(--primary); }
.old-price { font-size: 13px; color: var(--danger); text-decoration: line-through; text-decoration-thickness: 1px; }
.card-body .price-row { margin-bottom: 0; }
.stock-low { font-size: 12px; color: var(--danger); font-weight: 700; }
.add-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
}
.add-btn:hover { background: var(--primary-dark); }
.add-btn:disabled { background: #c8cbe0; cursor: not-allowed; }

/* ---------- Track ---------- */
.track-section { padding: 0 0 50px; }
.track-section h2 { text-align: center; margin-bottom: 16px; }
.track-box {
    display: flex;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto 20px;
}
.track-box input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
}
.track-result { max-width: 560px; margin: 0 auto; }
.track-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.track-card .t-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}
.status-pill {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}
.status-pill.pending { background: #fef3c7; color: #b45309; }
.status-pill.processing { background: #dbeafe; color: #1d4ed8; }
.status-pill.done { background: #d1fae5; color: #065f46; }
.status-pill.canceled { background: #fee2e2; color: #b91c1c; }

/* ---------- Footer ---------- */
.footer { background: #141a2c; color: #c7cce4; }
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 36px 20px 20px;
}
.footer .logo { color: #fff; }
.footer p { font-size: 13px; margin-top: 8px; color: #9aa2c0; }
.footer-contact div { font-size: 14px; padding: 4px 0; }
.footer-bottom {
    border-top: 1px solid #232b47;
    padding: 14px 20px;
    font-size: 12px;
    text-align: center;
    color: #7a82a5;
}

/* ---------- Drawer ---------- */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 380px;
    max-width: 100vw;
    height: 100vh;
    background: var(--card);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.drawer-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--muted);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.empty-cart { text-align: center; color: var(--muted); padding: 40px 0; font-size: 15px; }
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}
.cart-item .em { font-size: 28px; }
.cart-item .info { flex: 1; }
.cart-item .name { font-size: 14px; font-weight: 700; }
.cart-item .unit { font-size: 12px; color: var(--muted); }
.qty-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.qty-row button {
    width: 26px; height: 26px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    font-weight: 800;
}
.qty-row .qty { min-width: 24px; text-align: center; font-weight: 700; }
.remove-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; }
.drawer-footer { padding: 18px 20px; border-top: 1px solid var(--border); }
.cart-total {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 12px;
    text-align: center;
}
.cart-total span { color: var(--primary); }

/* ---------- Overlay / Modal ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 14, 28, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
    background: var(--card);
    border-radius: 18px;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 30px 70px rgba(12, 14, 28, 0.3);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-header h3 { font-size: 19px; }
.modal-card input,
.modal-card textarea {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
}
.row { display: flex; gap: 10px; }
.row input { flex: 1; min-width: 0; }
.pay-label { font-size: 14px; font-weight: 700; display: block; margin: 6px 0 8px; }
.pay-methods { display: flex; gap: 18px; margin-bottom: 16px; }
.pay-methods label { font-size: 14px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.modal-error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}
.modal-error.show { display: block; }
.success-body { text-align: center; padding: 8px 0 4px; }
.success-body .big-ref {
    font-size: 30px;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 3px;
    margin: 10px 0;
}
.success-body .sum { font-size: 15px; color: var(--muted); }
.success-body .hint { font-size: 13px; color: var(--muted); margin-top: 12px; background: var(--bg); padding: 10px; border-radius: 10px; }

@media (max-width: 640px) {
    .nav { display: none; }
    .hero h1 { font-size: 26px; }
    .row { flex-direction: column; gap: 0; }
}