/* ===== Modal Styling ===== */
.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    background: #ffffff;
    overflow: hidden;
}

/* هدر مودال */
.modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 20px 24px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-weight: 700;
    font-size: 18px;
    color: #333;
    margin: 0;
}

.modal-header .close {
    padding: 0;
    margin: 0;
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #666;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 1;
    float: none;
}

.modal-header .close:hover {
    background: #ffecf0;
    color: #e24a4a;
    transform: rotate(90deg);
}

/* بدنه مودال */
.modal-body {
    padding: 20px 24px;
}

/* ===== Search Input Styling ===== */
.heightlistcity .form-group {
    margin-bottom: 20px;
}

.heightlistcity .input-group {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.heightlistcity .input-group:focus-within {
    background: #ffffff;
    border-color: #e24a4a;
    box-shadow: 0 0 0 4px rgba(226, 74, 74, 0.1);
}

.heightlistcity .form-control {
    border: none;
    background: transparent;
    font-size: 14px;
    padding: 10px 15px;
    box-shadow: none !important;
    height: 44px;
}

.heightlistcity .input-group-append {
    display: flex;
    align-items: center;
    margin: 0;
}

.heightlistcity .btn-group-gray {
    border: none;
    background: #fff;
    color: #e24a4a;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 0;
    z-index: 5;
}

/* تنظیم فاصله دکمه جستجو بر اساس جهت */
html[dir="rtl"] .heightlistcity .btn-group-gray {
    margin-left: 2px;
}

html[dir="ltr"] .heightlistcity .btn-group-gray {
    margin-right: 2px;
}

/* ===== City List Items (Grid System) ===== */
.heightlistcity {
    max-height: 400px;
    overflow-y: auto;
    padding-left: 5px;
}

.heightlistcity::-webkit-scrollbar {
    width: 6px;
}
.heightlistcity::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.heightlistcity::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.heightlistcity::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.citylistitems ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* استایل کلی آیتم لیست */
.citylistitems li {
    position: relative;
    padding: 0;
    background: #ffffff;
    border: 1px solid #eef0f2;
    border-radius: 10px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.citylistitems li:has(input:checked) {
    border-color: #e24a4a;
    background: #fff5f5;
    box-shadow: 0 4px 12px rgba(226, 74, 74, 0.15);
}

.citylistitems li.active {
    border-color: #e24a4a;
    background: #fff5f5;
}

.citylistitems li:hover {
    border-color: #e24a4a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(226, 74, 74, 0.1);
}

/* لیبل کل فضای کارت را پر میکند */
.city-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 12px 14px;
    cursor: pointer;
    margin: 0;
    font-size: .9rem;
    color: #555;
    user-select: none;
}

.city-checkbox-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkmark {
    position: relative;
    height: 20px;
    width: 20px;
    background-color: #f0f0f0;
    border-radius: 6px;
    border: 1px solid #d1d1d1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.custom-checkmark::after {
    content: "";
    position: absolute;
    display: none;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.city-checkbox-input:checked ~ .custom-checkmark {
    background-color: #e24a4a;
    border-color: #e24a4a;
}

.city-checkbox-input:checked ~ .custom-checkmark::after {
    display: block;
}

/* متن شهر */
.city-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

/* تنظیمات اختصاصی جهت متن برای RTL و LTR */
html[dir="rtl"] .city-name {
    text-align: right;
    padding-left: 8px;
}

html[dir="ltr"] .city-name {
    text-align: left;
    padding-right: 8px;
}

.city-checkbox-input:checked ~ .city-name {
    color: #e24a4a;
    font-weight: 600;
}

/* ===== Footer Buttons ===== */
.modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 16px 24px;
    display: flex;
    gap: 10px;
    background: #fdfdfd;
    justify-content: flex-end;
}

.modal-footer .btn {
    border-radius: 10px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.enseraf_btn_city {
    background-color: #f1f3f5;
    color: #636e72;
    border: none;
}
.enseraf_btn_city:hover {
    background-color: #e9ecef;
    color: #2d3436;
}

.taed_btn_city {
    background-color: #e24a4a;
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(226, 74, 74, 0.3);
    flex-grow: 1;
}
.taed_btn_city:hover {
    background-color: #bd3535;
    transform: translateY(-1px);
    color: white !important;
    box-shadow: 0 6px 20px rgba(226, 74, 74, 0.4);
}

/* ===== Mobile Responsive Styles ===== */
@media (max-width: 576px) {
    body { padding: 10px; }
    .modal-dialog { margin: 0.5rem; }
    .modal-header, .modal-body, .modal-footer { padding: 15px; }
    .modal-title { font-size: 16px; }
    .heightlistcity { max-height: 55vh; }
    .citylistitems ul { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .citylistitems li { font-size: 12px; }
    .city-checkbox-label { padding: 10px 8px; }
    .modal-footer .btn { padding: 10px 15px; font-size: 13px; }
    .custom-checkmark { width: 18px; height: 18px; }
}