/* =========================================
   MODALS & OVERLAYS CENTRALIZED STYLES
   ========================================= */

/* --- News Page Modals --- */
.news-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    z-index: 2000;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0;
    box-sizing: border-box;
    align-items: flex-end;
    justify-content: center;
}

.news-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    border-radius: 30px 30px 0 0;
    height: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpSheet 0.5s cubic-bezier(0.175, 0.885, 0.32, 1);
    position: relative;
    box-shadow: 0 -15px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-bottom: none;
}

.modal-header-drag {
    width: 100%;
    padding: 15px 0 10px;
    display: flex;
    justify-content: center;
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
}

.modal-header-drag::after {
    content: '';
    width: 60px;
    height: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    display: block;
    transition: background 0.3s;
}

.modal-header-drag:hover::after {
    background: rgba(0, 0, 0, 0.3);
}

.modal-scrollable-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 30px;
}

.modal-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 70vh;
    overflow: hidden;
    background: #0f172a;
}

.modal-slides-track {
    display: flex;
    position: absolute;
    inset: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.modal-slides-track::-webkit-scrollbar {
    display: none;
}

.modal-slide-item {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
}

/* خلفية ضبابية تملأ الهوامش عند اختلاف مقاس الصورة */
.modal-slide-item .slide-bg {
    position: absolute;
    inset: -30px;
    background-size: cover;
    background-position: center;
    filter: blur(28px) brightness(0.65);
}

.modal-slide-item img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    display: block;
}

.modal-slide-item.is-video {
    background: #000;
}

.modal-slide-item video,
.modal-slide-item iframe {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #000;
    object-fit: contain;
}

.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: background 0.3s;
    font-size: 1.2rem;
}

.modal-nav-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-nav-right {
    right: 20px;
}

.modal-nav-left {
    left: 20px;
}

.slider-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: 0.3s;
}

.slider-dot.active {
    background: #fff;
    transform: scale(1.3);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.modal-body {
    padding: 40px 50px 20px;
    background: #fff;
}

.close-modal {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    font-size: 1.4rem;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.05);
}

.close-modal:hover {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
    transform: rotate(90deg) scale(1.05);
}

.modal-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid rgba(0,0,0,0.04);
    font-size: 0.95rem;
    color: #666;
    font-weight: 600;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.03);
    padding: 6px 14px;
    border-radius: 20px;
}

.meta-item.highlight {
    background: rgba(191,160,106,0.1);
    color: var(--primary);
}

/* --- Article Reading Experience --- */
.modal-text-content {
    padding: 0 50px 40px;
    font-size: 1.15rem;
    line-height: 1.9;
    color: #333;
    font-family: 'Cairo', sans-serif;
}

.modal-text-content p {
    margin-bottom: 25px;
}

.modal-text-content strong {
    color: var(--primary);
}

.modal-text-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(191,160,106,0.4);
    transition: 0.3s;
}

.modal-text-content a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.lightbox.show {
    opacity: 1;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lightbox.show img {
    transform: scale(1);
}

.close-lightbox {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3010;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
    backdrop-filter: blur(5px);
}

.close-lightbox:hover {
    background: rgba(255, 255, 255, 0.4);
}

@keyframes slideUpSheet {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .modal-slider { max-height: 60vh; }
    .modal-body { padding: 25px 20px 15px; }
    .modal-text-content { padding: 0 20px 30px; font-size: 1.05rem; line-height: 1.7; }
    .modal-meta-row { flex-direction: column; gap: 10px; align-items: flex-start; }
    .news-modal-content { margin: 0 auto; width: 100%; border-radius: 12px; }
    .close-modal { display: none !important; }
    .modal-nav-btn { display: none; }
}


/* --- Login & Admin Dashboard Modals --- */
.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 42, 69, 0.95);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.admin-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.admin-modal-box {
    background: #fff;
    width: 100%;
    max-width: 450px;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideUp 0.3s ease;
}

#editOverlay {
    background: rgba(0, 0, 0, 0.6);
}


/* --- GPA Guidelines Modals --- */
.gpa-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.gpa-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.liquid-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%) scale(0.95);
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

.gpa-modal-overlay.active .liquid-modal {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.liquid-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.liquid-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: none;
}

.liquid-body::-webkit-scrollbar {
    display: none;
}

.liquid-footer {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    color: var(--primary-color);
    transition: 0.2s;
}

.close-modal-btn:active {
    background: rgba(0, 0, 0, 0.1);
}
