/* ==========================================================================
   GALLERY & LIGHTBOX COMPONENT (المرحلة 6)
   مكتبة عرض الصور خفيفة الوزن ومستقلة تماماً بـ Namespace خاص (.gl-)
   ========================================================================== */

/* إطار موحد لصور العيادة يضمن عدم قصها (object-fit: contain) */
.clinic-image-frame:not(.med-gallery-image) {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: var(--bg-subtle, #f1f5f9);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    border: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.clinic-image-frame:not(.med-gallery-image) img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    background-color: #0b112008;
    transition: transform 0.25s ease;
}
.clinic-image-frame:not(.med-gallery-image):hover img {
    transform: scale(1.03);
}

/* صورة الطبيب الدائرية الموحدة (object-fit: cover مع center top) */
.doctor-avatar-circle, .med-doctor-image {
    object-fit: cover !important;
    object-position: center top !important;
}

/* ==========================================================================
   LIGHTBOX OVERLAY (.gl-)
   ========================================================================== */
.gl-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(11, 17, 32, 0.92);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.2s ease;
    user-select: none;
    touch-action: pan-y;
}

.gl-lightbox.gl-active {
    display: flex;
    opacity: 1;
}

.gl-container {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gl-main-image {
    max-width: 90vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: var(--radius-md, 12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.15s ease-out;
}

/* أزرار التحكم */
.gl-btn-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
    z-index: 10;
}
.gl-btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gl-btn-prev, .gl-btn-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 10;
}

.gl-btn-prev:hover, .gl-btn-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.gl-btn-prev {
    right: 24px;
}

.gl-btn-next {
    left: 24px;
}

/* العداد */
.gl-counter {
    position: absolute;
    bottom: 24px;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
}

@media (max-width: 640px) {
    .gl-btn-prev { right: 8px; width: 40px; height: 40px; font-size: 16px; }
    .gl-btn-next { left: 8px; width: 40px; height: 40px; font-size: 16px; }
    .gl-btn-close { top: 12px; right: 12px; }
    .gl-main-image { max-width: 95vw; max-height: 75vh; }
}
