/* ساختار مودال (پاپ‌آپ) */
.chs-modal-overlay {
    display: none; position: fixed; z-index: 999999; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px); direction: rtl; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}
.chs-modal-overlay.show { display: flex; opacity: 1; }

.chs-modal-content {
    background-color: #f8fafc; margin: auto; padding: 0; border-radius: 24px;
    width: 90%; max-width: 700px; height: 85vh; max-height: 650px;
    position: relative; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column; overflow: hidden;
}
.chs-modal-overlay.show .chs-modal-content { transform: scale(1); }

/* هدر مودال */
.chs-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid #e2e8f0; background: #fff;
    border-radius: 24px 24px 0 0; position: relative; z-index: 10;
}
.chs-modal-header h3 { margin: 0; font-size: 1.15rem; color: #1e293b; font-weight: 800; flex-grow: 1; text-align: center; }

/* نوار جستجو */
.chs-search-bar {
    background: #fff; padding: 12px 24px; border-bottom: 1px solid #e2e8f0;
    position: relative; display: flex; align-items: center;
}
.chs-search-bar svg { position: absolute; right: 36px; top: 50%; transform: translateY(-50%); }
.chs-search-bar input {
    width: 100%; padding: 12px 16px 12px 40px; border: 1px solid #cbd5e1;
    border-radius: 12px; font-family: inherit; font-size: 0.95rem; background: #f1f5f9;
    transition: all 0.3s; outline: none; box-sizing: border-box;
}
.chs-search-bar input:focus { border-color: #3b82f6; background: #fff; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

/* دکمه‌های هدر */
.chs-back-btn {
    background: transparent; border: none; color: #3b82f6; font-family: inherit;
    font-size: 0.9rem; font-weight: 600; cursor: pointer; display: flex; align-items: center;
    gap: 4px; padding: 6px 12px; border-radius: 8px; transition: 0.2s; position: absolute; right: 16px;
}
.chs-back-btn:hover { background: #eff6ff; }
.chs-close-modal {
    background: #f1f5f9; color: #64748b; font-size: 24px; width: 36px; height: 36px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.2s; position: absolute; left: 16px; line-height: 1;
}
.chs-close-modal:hover { background: #ef4444; color: #fff; }

/* بدنه مودال */
.chs-modal-body { padding: 24px; overflow-y: auto; flex-grow: 1; position: relative; scrollbar-width: thin; }

/* گرید کاشی‌های جدید (Tiles) */
.car-items-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px;
}

.car-box {
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px;
    cursor: pointer; transition: all 0.3s ease; display: flex; flex-direction: column;
    overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.car-box:hover { 
    border-color: #3b82f6; transform: translateY(-4px); 
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15); 
}
.car-box-img { width: 100%; aspect-ratio: 1 / 1; background: #f8fafc; overflow: hidden; }
.car-box-img img { 
    width: 100%; height: 100%; object-fit: cover; /* پر کردن کل کادر مربع */
    transition: transform 0.4s ease;
}
.car-box:hover .car-box-img img { transform: scale(1.05); }
.car-box-title { 
    padding: 12px 8px; text-align: center; border-top: 1px solid #f1f5f9; background: #fff;
}
.car-box-title span { font-size: 0.9rem; color: #1e293b; font-weight: 700; line-height: 1.4; }

/* پیام جستجوی خالی */
.chs-no-results { display: none; text-align: center; color: #64748b; padding: 30px; font-size: 1rem; width: 100%; grid-column: 1 / -1; }

/* مرحله نهایی */
.chs-final-step { text-align: center; padding: 20px 0; }
.final-step-icon { margin-bottom: 20px; }
.final-step-icon svg { width: 64px; height: 64px; }
.chs-final-step h4 { font-size: 1.2rem; color: #1e293b; margin-bottom: 24px; line-height: 1.6; }
.highlight-car { color: #2563eb; font-weight: 800; background: #eff6ff; padding: 4px 12px; border-radius: 8px; }
.chs-part-search-wrap { display: flex; flex-direction: column; gap: 16px; max-width: 400px; margin: 0 auto; text-align: right; }
.chs-submit-btn { background: #10b981; color: #fff; border: none; padding: 14px; border-radius: 10px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: 0.3s; width: 100%; }
.chs-submit-btn:hover:not(:disabled) { background: #059669; transform: translateY(-2px); }
.chs-submit-btn:disabled { background: #cbd5e1; cursor: not-allowed; color: #64748b; }

.select2-container--default .select2-selection--single { height: 48px; border-radius: 10px; border: 1.5px solid #cbd5e1; display: flex; align-items: center; font-size: 0.95rem; }
.select2-container--default .select2-selection--single .select2-selection__arrow { top: 11px; left: 12px; right: auto; }

/* انیمیشن‌ها */
.chs-anim-forward { animation: slideForward 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
.chs-anim-backward { animation: slideBackward 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
@keyframes slideForward { 0% { opacity: 0; transform: translateX(-30px); } 100% { opacity: 1; transform: translateX(0); } }
@keyframes slideBackward { 0% { opacity: 0; transform: translateX(30px); } 100% { opacity: 1; transform: translateX(0); } }

.chs-loader-wrap { display: flex; justify-content: center; align-items: center; height: 200px; width: 100%; grid-column: 1 / -1;}
.loading-spinner { border: 3px solid #e2e8f0; border-top: 3px solid #3b82f6; border-radius: 50%; width: 36px; height: 36px; animation: spin 1s linear infinite; }
.chs-final-loading-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.95); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.chs-spinner { width: 50px; height: 50px; border: 4px solid #e2e8f0; border-top: 4px solid #2563eb; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }