/* styles.css - استایل‌های جدید برای فروشگاه لوازم یدکی */
:root {
    --primary: #1a3a6b;
    --primary-dark: #0f274a;
    --secondary: #e88b2a;
    --secondary-dark: #c97720;
    --text: #1a1a2e;
    --muted: #5a5a7a;
    --border: #e8ecf2;
    --surface: #ffffff;
    --surface-soft: #f4f6fb;
    --shadow: 0 8px 24px rgba(26, 58, 107, 0.08);
    --shadow-hover: 0 14px 32px rgba(26, 58, 107, 0.14);
    --radius: 16px;
    --tag-bg: #eef3fc;
    --tag-color: #1a3a6b;
}

@font-face {
    font-family: "Vazir";
    src: url("assets/fonts/Vazir.eot");
    src: url("assets/fonts/Vazir.eot?#iefix") format("embedded-opentype"), url("assets/fonts/Vazir.woff2") format("woff2"), url("assets/fonts/Vazir.woff") format("woff"), url("assets/fonts/Vazir.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Vazir", sans-serif;
    color: var(--text);
    background: #fafcff;
    direction: rtl;
    text-align: right;
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button, input, select {
    font: inherit;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--primary);
}

.logo-mark {
    width: 117px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
    flex-shrink: 0;
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    font-weight: 700;
}

.nav {
    display: flex;
    align-items: center;
    gap: 24px;
    color: var(--muted);
}

    .nav a:hover {
        color: var(--primary);
    }

/* ===== Products Section ===== */
.products-section {
    padding: 36px 0;
}

.section-header {
    margin-bottom: 22px;
}

    .section-header h2 {
        margin: 0 0 8px;
        font-size: clamp(1.4rem, 2vw, 2rem);
        color: var(--primary-dark);
    }

    .section-header p {
        margin: 0;
        color: var(--muted);
    }

/* ===== Toolbar - یک ردیف در دسکتاپ ===== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
    align-items: flex-end;
}

.search-box {
    flex: 2;
    min-width: 200px;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.search-box input,
.filter-select {
    width: 100%;
    height: 52px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 16px;
    background: var(--surface);
    outline: none;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

    .search-box input:focus,
    .filter-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 4px rgba(26,58,107,0.08);
    }

    .search-box input::placeholder {
        color: #9aa0a6;
        opacity: 1;
    }

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    padding-right: 4px;
}

.results-row {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.96rem;
}

/* ===== Products Grid ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-hover);
    }

.product-image-wrap {
    width: 100%;
    aspect-ratio: 1/1;
    background: var(--surface-soft);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-body {
    padding: 14px 16px;
}

.product-title {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--primary-dark);
    line-height: 1.6;
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.product-brand {
    font-weight: 600;
    color: var(--primary);
}

.product-category {
    background: var(--surface-soft);
    padding: 0 10px;
    border-radius: 999px;
    color: var(--muted);
}

.product-trucks {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.truck-tag {
    background: var(--tag-bg);
    color: var(--tag-color);
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 600;
    border: 1px solid rgba(26,58,107,0.12);
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.product-price {
    color: var(--secondary);
    font-weight: 800;
    font-size: 1rem;
}

.price-button {
    border: 1px solid rgba(232,139,42,0.25);
    padding: 6px 14px;
    background: rgba(232,139,42,0.08);
    color: var(--secondary);
    border-radius: 12px;
    transition: all 0.25s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .price-button:hover {
        background: var(--secondary);
        color: #fff;
        border-color: var(--secondary);
        transform: translateY(-1px);
        box-shadow: 0 4px 14px rgba(232,139,42,0.3);
    }

.stock-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.stock-in {
    background: #d1fae5;
    color: #065f46;
}

.stock-out {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== Empty State ===== */
.empty-state {
    margin-top: 24px;
    padding: 32px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--surface-soft);
    text-align: center;
    color: var(--muted);
}

    .empty-state h3 {
        margin: 0 0 8px;
        color: var(--primary-dark);
    }

/* ===== Contact Section ===== */
.info-section {
    padding: 40px 0;
}

.info-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.contact-card {
    text-align: center;
}

.contact-phone {
    display: inline-block;
    margin-top: 10px;
    font-size: 20px;
    font-weight: bold;
    color: var(--primary);
}

.enamad-box {
    margin-top: 20px;
}

/* ===== Footer ===== */
.site-footer {
    padding: 22px 0 32px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    text-align: center;
}

/* ===== Dialog ===== */
dialog#contactDialog {
    width: min(90vw, 420px);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0;
    box-shadow: var(--shadow-hover);
}

    dialog#contactDialog::backdrop {
        background: rgba(0,0,0,0.45);
    }

.contact-dialog {
    padding: 24px;
    background: var(--surface);
    text-align: center;
}

    .contact-dialog p {
        margin: 0 0 16px;
        line-height: 1.9;
    }

.dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 10px 20px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    border: 0;
    cursor: pointer;
}

    .dialog-close:hover {
        background: var(--primary-dark);
    }

/* ===== Product Detail Page ===== */
.stock-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

    .stock-pill.is-out {
        background: #fee2e2;
        color: #991b1b;
        border-color: #fca5a5;
    }

.product-detail-page {
    padding: 2rem 0 4rem;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
}

    .breadcrumb a {
        color: var(--primary);
        font-weight: 600;
    }

.product-hero {
    border-radius: 24px;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 2rem;
    align-items: start;
}

.product-detail-image-frame {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 20px;
    overflow: hidden;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.product-detail-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-detail-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-detail-title {
    margin: 0;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--primary-dark);
}

.product-detail-excerpt {
    color: var(--muted);
    line-height: 2;
}

.product-detail-price-box {
    padding: 1rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(26,58,107,0.06), rgba(232,139,42,0.08));
    border: 1px solid var(--border);
}

.product-detail-price {
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    font-weight: 800;
    color: var(--secondary);
}

.product-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0.8rem 1.5rem;
    border-radius: 14px;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 12px 28px rgba(26,58,107,0.25);
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
}

    .btn-primary:hover, .btn-secondary:hover {
        transform: translateY(-1px);
    }

.product-detail-grid {
    margin-top: 1.5rem;
}

.detail-card {
    padding: 1.25rem;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.section-header-tight {
    margin-bottom: 1rem;
}

.product-description {
    color: var(--text);
    line-height: 2.15;
}

.related-section {
    margin-top: 2rem;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .related-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 820px) {
    .header-inner {
        flex-direction: column;
        padding: 12px 0;
    }

    .nav {
        gap: 16px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-box,
    .filter-group {
        flex: 1 1 100%;
        min-width: unset;
        width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-detail-layout {
        grid-template-columns: 1fr;
    }

    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .related-products-grid {
        grid-template-columns: 1fr;
    }

    .product-detail-actions > * {
        width: 100%;
    }
}

/* ===== کد فنی روی تصویر ===== */
.product-detail-image-frame {
    position: relative;
}

.tech-code-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(26, 58, 107, 0.9);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* ===== کد فنی زیر عنوان ===== */
.product-tech-code {
    margin: 0.25rem 0 0.5rem 0;
    font-size: 0.95rem;
}

.tech-code-label {
    color: #666;
    font-weight: 400;
}

.tech-code-value {
    color: #1a3a6b;
    font-weight: 700;
    font-family: monospace;
    font-size: 1.05rem;
    background: #f0f4f8;
    padding: 0.1rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
}

/* ===== موقعیت نصب ===== */
.position-tag {
    display: inline-block;
    background: #e8f0fe;
    color: #1a3a6b;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== جدول اطلاعات فنی ===== */
.tech-specs-card {
    margin-top: 1.5rem;
}

.tech-specs-table-inner {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

    .tech-specs-table-inner tr {
        border-bottom: 1px solid #e9ecef;
    }

        .tech-specs-table-inner tr:last-child {
            border-bottom: none;
        }

    .tech-specs-table-inner th {
        text-align: right;
        padding: 0.6rem 0.8rem 0.6rem 1rem;
        color: #555;
        font-weight: 500;
        width: 35%;
        background: #f8fafc;
    }

    .tech-specs-table-inner td {
        padding: 0.6rem 0.8rem;
        color: #222;
        font-weight: 400;
    }

/* ===== بج کد فنی در کارت محصولات ===== */
.product-image-wrap {
    position: relative;
}

.product-code-badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(26, 58, 107, 0.85);
    color: #fff;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: monospace;
    font-weight: 700;
}

/* ===== واکنش‌گرایی ===== */
@media (max-width: 768px) {
    .tech-specs-table-inner th,
    .tech-specs-table-inner td {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }

    .tech-code-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}