:root {
    --primary: #1a3a6d;
    --secondary: #e9b44c;
    --dark: #2c3e50;
    --light: #f8f9fa;
    --gray: #6c757d;
}

.gallery-header {
    background: linear-gradient(135deg, var(--primary) 0%, #2c5282 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.gallery-header p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

/* فلتر المشاريع */
.gallery-filter {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 8px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* معرض المشاريع */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.project-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.project-media {
    position: relative;
    height: 250px;
    overflow: hidden;
    cursor: pointer;
}

.project-media img,
.project-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .project-media img,
.project-card:hover .project-media video {
    transform: scale(1.1);
}

/* شارة نوع الوسائط */
.media-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}

.video-badge {
    background: rgba(233, 180, 76, 0.9);
}

.image-badge {
    background: rgba(26, 58, 109, 0.9);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 58, 109, 0.85);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    text-align: center;
    z-index: 3;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-overlay h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.project-overlay p {
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.view-project-btn {
    background: var(--secondary);
    color: var(--dark);
    padding: 8px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 4;
    position: relative;
}

.view-project-btn:hover {
    background: #d19e3a;
    transform: translateY(-3px);
}

.project-info {
    padding: 15px;
}

.project-info h4 {
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.project-category {
    color: var(--gray);
    font-size: 0.9rem;
}

.no-projects {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--gray);
}

/* مودال التفاصيل */
.project-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    width: 90%;
    max-width: 800px;
    border-radius: 12px;
    position: relative;
    animation: modalFade 0.3s;
    max-height: 90vh;
    overflow: hidden;
}

@keyframes modalFade {
    from {opacity: 0; transform: scale(0.8);}
    to {opacity: 1; transform: scale(1);}
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--dark);
    cursor: pointer;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: white;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-media {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    max-height: 60vh;
}

.modal-media img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
}

.modal-media video {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
}

.media-type-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(233, 180, 76, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 2;
}

.modal-info {
    padding: 30px;
}

.modal-info h2 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.modal-category {
    display: inline-block;
    background: var(--light);
    color: var(--primary);
    padding: 5px 15px;
    border-radius: 30px;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.modal-info p {
    line-height: 1.6;
    color: var(--dark);
    margin-bottom: 25px;
}

.modal-actions {
    margin-top: 25px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: #152a4d;
    transform: translateY(-2px);
}

/* أزرار التنقل */
.modal-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    pointer-events: none;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: white;
    transform: scale(1.1);
}

/* أيقونة التشغيل للفيديوهات */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(233, 180, 76, 0.8);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    opacity: 1;
    transition: opacity 0.3s;
    cursor: pointer;
    z-index: 2;
}

.project-media:hover .play-icon {
    opacity: 1;
}

.youtube-badge {
    background: rgba(255, 0, 0, 0.9); /* اللون الأحمر المميز ليوتيوب */
}

/* تحسين عرض يوتيوب في المودال */
.modal-media iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
}

/* تحسين الصورة المصغرة ليوتيوب */
.youtube-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
}

.youtube-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* التجاوب للشاشات الصغيرة */
@media (max-width: 992px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .modal-body {
        grid-template-columns: 1fr;
        max-height: 80vh;
    }
    
    .modal-media {
        min-height: 300px;
        max-height: 50vh;
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .gallery-filter {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-btn {
        width: 100%;
        max-width: 250px;
        text-align: center;
    }
    
    .modal-content {
        width: 98%;
        margin: 2% auto;
    }
    
    .modal-info {
        padding: 20px;
    }
    
    .modal-info h2 {
        font-size: 1.5rem;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .modal-navigation {
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .project-media {
        height: 200px;
    }
    
    .modal-media {
        min-height: 250px;
        max-height: 40vh;
    }
    
    .modal-info {
        padding: 15px;
    }
}