/* تنسيقات الديلوج */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    overflow: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background-color: #ffffff;
    width: 100%;
    max-width: 900px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(-30px) scale(0.95);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 95vh;
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    color: #333333;
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #6c757d;
    transition: color 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: #333333;
    background-color: #e9ecef;
}

.modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-image-container {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    padding: 20px;
    min-height: 300px;
    max-height: 60vh;
    overflow: hidden;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-description {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    background-color: #ffffff;
    flex-shrink: 0;
    font-weight: bold;
}

.modal-description p {
    margin: 0;
    color: #555555;
    line-height: 1.7;
    font-size: 1.05rem;
    text-align: center;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    gap: 15px;
}

.modal-nav-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    justify-content: center;
}

.modal-nav {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.modal-nav:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.modal-nav:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.image-counter {
    font-weight: 600;
    color: #333333;
    font-size: 1rem;
    min-width: 80px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
}

.btn-close {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.btn-close:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

/* تنسيقات الرابط بدلاً من الزر */
.btn-price-link {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-price-link:hover {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
    color: white;
    text-decoration: none;
}

/* تنسيقات الهوفر على الصور */
.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.9));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay h3 {
    margin: 0 0 12px 0;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.3;
}

.gallery-overlay p {
    margin: 0 0 20px 0;
    font-size: 1rem;
    line-height: 1.5;
    opacity: 0.9;
}

.view-more-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.view-more-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.3);
}

/* تحسينات للاستجابة */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 98vh;
        max-width: 100%;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-close {
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }
    
    .modal-image-container {
        padding: 15px;
        max-height: 50vh;
    }
    
    .modal-description {
        padding: 15px 20px;
    }
    
    .modal-description p {
        font-size: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .modal-nav-container {
        order: 2;
        width: 100%;
        justify-content: space-between;
    }
    
    .modal-actions {
        order: 1;
        width: 100%;
        justify-content: space-between;
    }
    
    .modal-nav {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .btn-close, .btn-price {
        padding: 10px 15px;
        font-size: 0.9rem;
        flex: 1;
        text-align: center;
    }
    
    .image-counter {
        font-size: 0.9rem;
        min-width: 70px;
    }
    
    .gallery-overlay h3 {
        font-size: 1.1rem;
    }
    
    .gallery-overlay p {
        font-size: 0.9rem;
    }
    
    .view-more-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 12px 15px;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-image-container {
        padding: 10px;
        max-height: 45vh;
    }
    
    .modal-description {
        padding: 12px 15px;
    }
    
    .modal-footer {
        padding: 12px 15px;
    }
    
    .modal-nav {
        padding: 7px 12px;
        font-size: 0.85rem;
    }
    
    .btn-close, .btn-price {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .image-counter {
        font-size: 0.85rem;
        min-width: 60px;
    }
    
    .gallery-overlay {
        padding: 15px;
    }
    
    .gallery-overlay h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .gallery-overlay p {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .view-more-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}