/* تنسيقات عامة للحاويات */
.service-search-container,
.add-service-container,
.count-services-container,
.city-cards-container {
    width: 100%;
    max-width: 1280px;
    margin: 20px auto;
    padding: 20px;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 5px #DDDDDD;
    direction: rtl;
    text-align: center;
}

/* تنسيقات نموذج البحث */
.service-search-form .search-form-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
    align-items: flex-end;
}

.service-search-form .form-field {
    flex: 1 1 200px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.service-search-form .form-field-button {
    flex: 0 0 auto;
}

.service-search-form label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
    color: #FF6600;
    text-align: right;
}

.service-search-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #DDDDDD;
    border-radius: 4px;
    background: #F8F9FA;
    font-size: 14px;
    color: #1A355B;
    box-sizing: border-box;
}

.service-search-form select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.search-button {
    background: #007bff;
    color: #FFFFFF;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.search-button:hover {
    background: #0056b3;
}

/* تنسيقات نموذج إضافة الخدمة */
.add-service-container h2 {
    font-size: 24px;
    color: #FF6600;
    margin-bottom: 20px;
}

.toggle-service-form {
    background: #007bff;
    color: #FFFFFF;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.3s ease;
    margin-bottom: 20px;
}

.toggle-service-form:hover {
    background: #0056b3;
}

.add-service-form {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    display: none;
}

.form-field-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.form-field {
    flex: 1 1 300px;
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
    color: #1A355B;
    text-align: right;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #F8F9FA;
    font-size: 14px;
    color: #1A355B;
    text-align: right;
    box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.form-field input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.form-field .required {
    color: #ff0000;
}

.add-service-button {
    background: #007bff;
    color: #FFFFFF;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s ease;
}

.add-service-button:hover {
    background: #0056b3;
}

/* تنسيقات بطاقات المدن والخدمات */
.count-services-container,
.city-cards-container,
.service-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-end;
    direction: rtl;
    max-width: 1280px;
    margin: 0 auto;
}

.count-card,
.city-card,
.service-card {
    background: #F8F9FA;
    border: 1px solid #DDDDDD;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 5px #DDDDDD;
    cursor: pointer;
    transition: box-shadow 0.3s ease;
    direction: rtl;
    box-sizing: border-box;
    position: relative;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

/* العرض الافتراضي: 4 بطاقات في الصف */
.count-card,
.city-card,
.service-card {
    width: calc(25% - 15px);
}

.count-card:hover,
.city-card:hover,
.service-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* الصور داخل البطاقات */
.count-card .city-image-container,
.city-card .city-image-container,
.service-image-top {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 5px;
}

.count-card .city-image,
.city-card .city-image,
.main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 8px;
}

.count-card .city-name-overlay,
.city-card .city-name-overlay,
.service-card .city-name-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #007bff;
    color: #FFFFFF;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    animation: pulse 2s infinite;
    z-index: 10;
}

.service-count,
.city-service-count {
    font-size: 14px;
    color: #1A355B;
    text-align: center;
    margin-top: 5px;
    font-weight: bold;
    line-height: 1.2;
}

/* باقي تفاصيل بطاقات الخدمات */
.service-details-middle {
    margin: 5px 0;
}

.provider-info {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
}

.provider-icon {
    font-size: 16px;
    margin-left: 5px;
    color: #1A355B;
}

.provider-name {
    font-size: 16px;
    font-weight: bold;
    color: #1A355B;
    line-height: 1.2;
}

.service-description {
    font-size: 13px;
    color: #1A355B;
    line-height: 1.3;
    margin-bottom: 5px;
}

.service-description p {
    margin: 2px 0;
}

.contact-icons-bottom {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 5px;
}

.contact-item {
    display: flex;
    align-items: center;
}

.contact-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.contact-icon.whatsapp img {
    width: 26px;
    height: 26px;
}

.phone-number {
    font-size: 13px;
    color: #1A355B;
    margin-right: 5px;
    line-height: 1.2;
}

.rating-section {
    margin-bottom: 5px;
}

.rating-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-value {
    font-size: 13px;
    color: #1A355B;
    line-height: 1.2;
}

.rating-login-notice {
    font-size: 11px;
    color: #1A355B;
    margin-top: 3px;
    line-height: 1.2;
}

.service-footer {
    margin-top: 5px;
}

.service-footer .map {
    width: 100%;
    height: 100px;
    border-radius: 4px;
}

/* تأثير نبض على الخلفية */
@keyframes pulse {
    0% { background: #007bff; }
    50% { background: #0056b3; }
    100% { background: #007bff; }
}

/* تنسيقات متجاوبة */

/* أقل من 1200 بكسل: 3 بطاقات في الصف */
@media (max-width: 1200px) {
    .count-card,
    .city-card,
    .service-card {
        width: calc(33.33% - 13.33px);
    }
}

/* أقل من 768 بكسل: 2 بطاقة في الصف */
@media (max-width: 768px) {
    .service-search-form .search-form-horizontal,
    .form-field-horizontal {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .form-field:nth-child(7), 
    .form-field:nth-child(8), 
    .form-field:nth-child(10), 
    .form-field:nth-child(11) {
        grid-column: span 2;
    }

    .service-search-form .form-field,
    .form-field {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .service-search-form .form-field-button,
    .form-field-button {
        align-self: stretch;
    }

    .search-button,
    .add-service-button {
        width: 100%;
        padding: 12px;
    }

    .count-card,
    .city-card,
    .service-card {
        width: calc(50% - 10px);
    }

    .count-card .city-image-container,
    .city-card .city-image-container,
    .service-image-top {
        width: 100%;
        height: 160px;
        max-width: 333px;
        margin: 0 auto 4px;
    }

    .count-card .city-image,
    .city-card .city-image,
    .main-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
    }

    .count-card .city-name-overlay,
    .city-card .city-name-overlay,
    .service-card .city-name-overlay {
        padding: 5px 10px;
        font-size: 15px;
    }

    .service-count {
        margin-top: 2px;
    }

    .service-details-middle {
        margin: 3px 0;
    }

    .provider-info {
        margin-bottom: 2px;
    }

    .service-description {
        margin-bottom: 3px;
    }

    .contact-icons-bottom {
        margin-bottom: 3px;
    }

    .rating-section {
        margin-bottom: 3px;
    }

    .service-footer {
        margin-top: 3px;
    }
}

/* أقل من 480 بكسل: بطاقة واحدة في الصف تغطي العرض بالكامل */
@media (max-width: 480px) {
    .service-search-form .search-form-horizontal,
    .form-field-horizontal {
        grid-template-columns: 1fr;
    }

    .form-field:nth-child(7), 
    .form-field:nth-child(8), 
    .form-field:nth-child(10), 
    .form-field:nth-child(11) {
        grid-column: span 1;
    }

    .count-card,
    .city-card,
    .service-card {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin-bottom: 15px;
        box-sizing: border-box;
    }

    /* تقليل الهوامش بين البطاقات */
    .count-services-container,
    .city-cards-container,
    .service-cards {
        gap: 10px;
        justify-content: center;
        padding: 0 10px;
    }

    /* تعديل حجم الصور داخل البطاقات */
    .count-card .city-image-container,
    .city-card .city-image-container,
    .service-image-top {
        width: 100%;
        height: 180px;
        max-width: 100%;
        margin-bottom: 8px;
        border-radius: 8px;
    }

    .count-card .city-image,
    .city-card .city-image,
    .main-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        border-radius: 8px;
    }

    /* تعديل النصوص داخل البطاقات */
    .count-card .city-name-overlay,
    .city-card .city-name-overlay,
    .service-card .city-name-overlay {
        padding: 6px 12px;
        font-size: 16px;
        font-weight: 700;
        border-radius: 6px;
    }

    .service-count,
    .city-service-count {
        font-size: 14px;
        margin-top: 5px;
        font-weight: bold;
        color: #1A355B;
    }
}
