/* --- Gallery Filters (أزرار الأقسام) --- */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
}
/* ========================================= */
/* --- شاشة التحميل (Preloader) --- */
/* ========================================= */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #e5e5e5; /* الشاشة بقت رصاصي */
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 180px;
    height: 180px;
}

/* الدايرة النحاسي اللي بتلف حوالين اللوجو */
.preloader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(200, 129, 65, 0.2); /* نحاسي شفاف */
    border-top-color: var(--copper); /* نحاسي صريح من فوق */
    animation: spin 1s linear infinite;
}

.preloader-logo {
    width: 110px; 
    border-radius: 50%; /* عشان لو اللوجو ليه خلفية بيضاء يتقص بشكل دائري */
    animation: heartbeat 1.2s infinite alternate ease-in-out;
}

/* حركة اللف */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* حركة النبض */
@keyframes heartbeat {
    0% { transform: scale(0.95); filter: drop-shadow(0 0 0px rgba(200, 129, 65, 0)); }
    100% { transform: scale(1.05); filter: drop-shadow(0 10px 20px rgba(200, 129, 65, 0.4)); }
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
}
.filter-btn {
    padding: 8px 22px;
    background-color: #ffffff;
    border: 2px solid #eaeaea;
    border-radius: 30px;
    color: var(--text-gray, #666666);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.filter-btn:hover {
    border-color: var(--copper, #c88141);
    color: var(--copper, #c88141);
    transform: translateY(-2px);
}

.filter-btn.active {
    background-color: var(--copper, #c88141);
    border-color: var(--copper, #c88141);
    color: #ffffff;
    box-shadow: 0 8px 15px rgba(200, 129, 65, 0.25);
}

/* --- Gallery Grid & Animations --- */
.portfolio {
    background-color: var(--white, #ffffff);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.gallery-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    cursor: pointer;
    height: 260px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

/* كلاس الإخفاء الذي يتم إضافته بالجافاسكريبت */
.gallery-item.hide {
    display: none;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    bottom: -100%; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    display: flex; 
    flex-direction: column; 
    justify-content: flex-end;
    padding: 20px; 
    transition: bottom 0.4s ease;
}

.gallery-item:hover .gallery-overlay {
    bottom: 0;
}

.gallery-overlay h4 {
    color: #ffffff; 
    font-size: 1.2rem; 
    margin-bottom: 0;
    font-weight: bold;
}

/* --- Lightbox Modal (نافذة عرض الصور) --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.92);
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(5px);
}

.lightbox.show {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    object-fit: contain;
}

.lightbox.show .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #f1f1f1;
    font-size: 45px;
    font-weight: 300;
    transition: 0.3s;
    cursor: pointer;
    z-index: 100000;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: var(--copper, #c88141);
    transform: scale(1.1);
}

#lightbox-caption {
    margin: 20px auto 0;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* تظبيط الموبايل */
@media (max-width: 768px) {
    .lightbox-close {
        top: 15px;
        right: 25px;
        font-size: 35px;
    }
    .lightbox-content {
        max-width: 95%;
        max-height: 70vh;
    }
}