/* ==================== متغیرها و ریست ==================== */
:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --accent: #f59e0b;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-panel: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 10px 40px rgba(0,0,0,0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== هدر ==================== */
.header {
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    max-width: 1100px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.logo h1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1.2;
}

.logo p {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* منوی جمع‌وجور */
.nav,
.nav.nav-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    flex-wrap: nowrap;
}

.nav-link,
.nav-quick {
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: all 0.15s;
}

.nav-link:hover,
.nav-link.active,
.nav-quick:hover,
.nav-quick.active {
    color: var(--text);
    background: rgba(59, 130, 246, 0.15);
}

.nav-more-btn {
    margin-right: 4px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}
.nav-more-btn:hover,
.nav-more-btn.open {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
}

.nav-panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 520px;
    max-width: min(640px, 92vw);
    background: #1e293b;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.45);
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
    z-index: 200;
}
.nav-panel.open {
    display: grid;
}
.nav-panel-group {
    min-width: 0;
}
.nav-panel-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(148,163,184,.15);
}
.nav-panel-link {
    display: block;
    padding: 6px 8px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
}
.nav-panel-link:hover,
.nav-panel-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #fff;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.menu-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

@media (max-width: 800px) {
    .nav-quick { display: none; }
    .nav-more-btn { display: none; }
    .menu-toggle { display: flex; }
    .nav,
    .nav.nav-compact {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: #0f172a;
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px 20px;
        max-height: 80vh;
        overflow-y: auto;
    }
    .nav.open {
        display: flex;
    }
    .nav-panel {
        display: grid !important;
        position: static;
        min-width: 0;
        max-width: none;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        grid-template-columns: 1fr;
    }
    .nav-panel.open { display: grid !important; }
    .nav-quick {
        display: block;
        padding: 10px 12px;
    }
}

/* ==================== بخش نمایشگر ==================== */
 */
.viewer-section {
    min-height: calc(100vh - 70px);
    padding: 20px;
}

.viewer-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 16px;
    height: calc(100vh - 110px);
    max-height: 900px;
}

/* پنل قطعات */
.parts-panel {
    background: var(--bg-panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary-light);
}

.search-box .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    pointer-events: none;
}

.parts-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.part-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.part-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

.part-item.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary-light);
}

.part-item .part-icon {
    font-size: 1.3rem;
    width: 32px;
    text-align: center;
}

.part-item .part-name {
    font-size: 0.95rem;
    font-weight: 500;
}

.part-item .part-category {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ناحیه کانواس */
.canvas-wrapper {
    position: relative;
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

#canvas-container {
    width: 100%;
    height: 100%;
}

.viewer-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.viewer-controls button {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.viewer-controls button:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.viewer-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    z-index: 10;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: opacity 0.4s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    max-width: 280px;
}

/* پنل اطلاعات */
.info-panel {
    background: var(--bg-panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.close-info {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.3);
    border: none;
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    z-index: 5;
    display: none;
}

.info-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.info-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.info-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.info-header .category-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-light);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.info-header h3 {
    font-size: 1.35rem;
    font-weight: 600;
}

.info-section {
    margin-bottom: 20px;
}

.info-section h4 {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-section p,
.info-section ul {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    padding: 6px 0;
    padding-right: 18px;
    position: relative;
}

.info-section li::before {
    content: "•";
    position: absolute;
    right: 0;
    color: var(--primary-light);
}

.symptoms-list li {
    background: rgba(239, 68, 68, 0.08);
    border-radius: 6px;
    padding: 8px 12px 8px 12px;
    margin-bottom: 6px;
    border-right: 3px solid var(--danger);
}

.symptoms-list li::before {
    display: none;
}

/* ==================== بخش درباره ==================== */
.about-section {
    padding: 60px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.about-section h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 16px;
}

.about-section > .container > p {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 40px;
    color: var(--text-muted);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-light);
}

.feature-card span {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ==================== فوتر ==================== */
.footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
}

.footer p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-note {
    font-size: 0.8rem !important;
    margin-top: 6px;
    opacity: 0.7;
}

/* ==================== ریسپانسیو ==================== */
@media (max-width: 1100px) {
    .viewer-container {
        grid-template-columns: 240px 1fr;
        grid-template-rows: 1fr auto;
    }

    .info-panel {
        grid-column: 1 / -1;
        max-height: 280px;
    }

    .close-info {
        display: block;
    }
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: 12px;
        border-bottom: 1px solid var(--border);
    }

    .nav.open {
        display: flex;
    }

    .menu-toggle {
        display: flex;
    }

    .viewer-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
        min-height: calc(100vh - 100px);
    }

    .parts-panel {
        max-height: 220px;
    }

    .canvas-wrapper {
        height: 360px;
    }

    .viewer-hint {
        font-size: 0.7rem;
        white-space: normal;
        text-align: center;
        max-width: 90%;
    }

    .info-panel {
        max-height: 300px;
    }
}

/* اسکرول‌بار سفارشی */
.parts-list::-webkit-scrollbar,
.info-content::-webkit-scrollbar {
    width: 6px;
}

.parts-list::-webkit-scrollbar-track,
.info-content::-webkit-scrollbar-track {
    background: transparent;
}

.parts-list::-webkit-scrollbar-thumb,
.info-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* تصویر قطعه — هر سایز PNG/JPG داخل کادر جا می‌شود */
.part-image-wrap {
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0b1220;
    width: 100%;
    height: 220px;
    max-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.part-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
}

/* انتخاب خودرو */
.car-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.car-btn {
    flex: 1 1 auto;
    min-width: 70px;
    padding: 8px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    line-height: 1.3;
}

.car-btn:hover {
    border-color: var(--primary-light);
    color: var(--text);
}

.car-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary-light);
    color: var(--text);
    font-weight: 600;
}

.car-btn .car-icon {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.price-search-btn {
    display: block;
    text-align: center;
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.price-search-btn:hover {
    background: #f59e0b;
    color: #0f172a;
    border-color: #f59e0b;
}

@media (max-width: 1100px) {
  .nav.open {
    max-height: 70vh;
    overflow-y: auto;
  }
}
.nav {
  flex-wrap: wrap;
  gap: 4px 8px;
}
.nav-link {
  font-size: 0.82rem;
  padding: 6px 8px;
}

#canvas-container {
  background: linear-gradient(180deg, #87ceeb 0%, #cfe9f5 40%, #a8c686 100%);
}
.loading-overlay {
  background: rgba(255,255,255,0.55) !important;
  color: #0f172a !important;
}
.loading-overlay p, .loading-note {
  color: #1e293b !important;
}


/* نقشه سایت فوتر */
.site-map {
    width: 100%;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(148,163,184,.2);
}
.site-map-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    text-align: right;
    max-width: 920px;
    margin: 0 auto;
}
.site-map-col h4 {
    margin: 0 0 8px;
    font-size: 0.85rem;
    color: #e2e8f0;
}
.site-map-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-map-col li {
    margin-bottom: 4px;
}
.site-map-col a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8rem;
}
.site-map-col a:hover {
    color: #93c5fd;
}
.footer .container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
