/* ========== INSTITUTIONS PAGE STYLES ========== */

:root {
    --primary: #1e3a5f;
    --secondary: #2c5aa0;
    --accent: #4a90e2;
    --gold: #d4af37;
    --light: #f8fafc;
    --dark: #0f172a;
    --gray: #64748b;
    --gradient: linear-gradient(135deg, #1e3a5f 0%, #4a90e2 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: auto;
}

body {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    background: var(--dark);
    color: var(--light);
    line-height: 1.7;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 4rem 0;
    padding-top: calc(4rem + 85px);
}

.section-header {
    padding: 0 4rem;
    margin-bottom: 2rem;
    border-right: 5px solid var(--gold);
    margin-right: 2rem;
}

.section-tag {
    display: inline-block;
    color: var(--gold);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.section-title {
    font-family: 'Kufam', serif;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.5rem;
    font-weight: 800;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.section-desc {
    font-size: 1.1rem;
    color: #94a3b8;
    max-width: 700px;
}

/* --- HORIZONTAL SCROLL LAYOUT --- */

.scroll-container {
    display: flex;
    overflow-x: auto;
    padding: 2rem 2rem 4rem 2rem;
    gap: 1.5rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) var(--primary);
}

/* Custom Scrollbar Styling */
.scroll-container::-webkit-scrollbar {
    height: 8px;
}
.scroll-container::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 10px;
}
.scroll-container::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 10px;
}

.game-card {
    flex: 0 0 220px;
    height: 380px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    background: #1e293b;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4) grayscale(80%);
    transition: all 0.6s ease;
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 40%, rgba(0,0,0,0) 100%);
    z-index: 2;
}

.card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    z-index: 3;
    transform: translateY(0);
    transition: all 0.4s ease;
}

.card-title {
    font-family: 'Amiri', serif;
    font-size: 1.4rem;
    color: white;
    margin-bottom: 0.5rem;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.card-info {
    font-size: 0.9rem;
    color: #cbd5e1;
    opacity: 0.8;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease;
}

.action-btn {
    margin-top: 1rem;
    background: var(--gold);
    color: #000;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease 0.1s;
    font-size: 0.9rem;
    width: fit-content;
}

/* --- HOVER EFFECTS --- */

.game-card:hover {
    flex: 0 0 320px;
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 0 2px var(--gold);
    z-index: 10;
}

.game-card:hover .card-bg {
    filter: brightness(1.1) grayscale(0%);
    transform: scale(1);
}

.game-card:hover .card-info {
    max-height: 100px;
    opacity: 1;
    margin-bottom: 0.5rem;
}

.game-card:hover .action-btn {
    opacity: 1;
    transform: translateY(0);
}

/* Special Styling for Associations */
.assoc-container .game-card {
    flex: 0 0 400px;
    background: var(--gradient);
}
.assoc-container .game-card img {
    object-fit: contain;
    padding: 2rem;
    filter: brightness(0) invert(1) opacity(0.5);
}
.assoc-container .game-card:hover img {
    filter: brightness(0) invert(1) opacity(1);
}

@media (max-width: 768px) {
    .assoc-container .game-card {
        flex: 0 0 200px;
        height: 320px;
    }
}

@media (max-width: 600px) {
    .assoc-container .game-card {
        flex: 0 0 180px;
        height: 300px;
    }
    .assoc-container .game-card:hover {
        flex: 0 0 240px;
    }
}

@media (max-width: 480px) {
    .assoc-container {
        padding: 0.6rem 0.6rem 2rem 0.6rem !important;
        gap: 0.8rem !important;
    }
    .assoc-container .game-card {
        flex: 0 0 160px;
        height: 280px;
    }
    .assoc-container .game-card:hover {
        flex: 0 0 200px;
    }
}

@media (max-width: 360px) {
    .assoc-container {
        padding: 0.5rem 0.5rem 1.5rem 0.5rem !important;
        gap: 0.6rem !important;
    }
    .assoc-container .game-card {
        flex: 0 0 140px;
        height: 240px;
    }
    .assoc-container .game-card:hover {
        flex: 0 0 180px;
    }
}

/* --- Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #1e293b;
    margin: 2% auto;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 20px;
    overflow: hidden;
    animation: slideUp 0.4s ease;
    color: white;
    border: 1px solid #334155;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    background: var(--gradient);
    padding: 2rem;
    position: relative;
}

.close-modal {
    position: absolute;
    left: 2rem;
    top: 2rem;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
}

.modal-body { padding: 2rem; overflow-y: auto; max-height: calc(90vh - 150px); }
.modal-section h3 { color: var(--gold); border-right: 3px solid var(--accent); padding-right: 1rem; margin-bottom: 1rem; }
.modal-section ul li { border-bottom: 1px solid #334155; color: #cbd5e1; padding: 0.8rem 0; }
.contact-info { background: #0f172a; padding: 1.5rem; border-radius: 12px; }
.contact-item strong { color: var(--accent); }
.image-gallery img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; }

/* CMS Section in Modal */
.cms-section { background: rgba(212, 175, 55, 0.1); border: 1px solid var(--gold); padding: 1.5rem; border-radius: 12px; margin-top: 2rem; }
.cms-section h4 { color: var(--gold); }
.cms-btn { background: var(--gold); color: black; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-weight: bold; cursor: pointer; }

@media (max-width: 768px) {
    .section-header { padding: 0 1.5rem; margin-right: 0; border: none; text-align: center; }
    .section-tag { display: block; }
    .scroll-container { padding: 1rem 1rem 3rem 1rem; }
    .game-card { flex: 0 0 200px; height: 320px; }
    .modal-content { margin: 5% auto; width: 95%; max-height: 85vh; }
    .close-modal { left: 1rem; top: 1rem; font-size: 1.5rem; width: 35px; height: 35px; }
    .modal-body { padding: 1.5rem; max-height: calc(85vh - 120px); }
    .modal-section h3 { font-size: 1.1rem; }
    .modal-section ul li { font-size: 0.9rem; }
}

@media (max-width: 600px) {
    .container { padding: 2rem 0; }
    .section-header { padding: 0 1rem; margin-right: 0; }
    .section-title { font-size: 1.6rem; }
    .section-desc { font-size: 0.95rem; }
    .section-tag { font-size: 0.75rem; padding: 0.3rem 0.8rem; }
    .scroll-container { padding: 0.8rem 0.8rem 2.5rem 0.8rem; gap: 1rem; }
    .game-card { flex: 0 0 180px; height: 300px; }
    .game-card:hover { flex: 0 0 240px; }
    .card-title { font-size: 1.2rem; }
    .card-info { font-size: 0.85rem; }
    .action-btn { padding: 0.5rem 1.2rem; font-size: 0.85rem; }
    .modal-content { margin: 8% auto; width: 98%; max-height: 80vh; border-radius: 15px; }
    .modal-header { padding: 1.5rem; }
    .close-modal { left: 0.8rem; top: 0.8rem; font-size: 1.3rem; width: 32px; height: 32px; }
    .modal-body { padding: 1.2rem; max-height: calc(80vh - 100px); font-size: 0.95rem; }
    .modal-section h3 { font-size: 1rem; margin-bottom: 0.8rem; }
    .modal-section ul li { font-size: 0.85rem; padding: 0.6rem 0; }
    .contact-info { padding: 1rem; }
    .contact-item strong { font-size: 0.9rem; }
}

@media (max-width: 480px) {
    .container { padding: 1.5rem 0; padding-top: calc(1.5rem + 85px); }
    .section-header { padding: 0 0.8rem; margin-bottom: 1.8rem; }
    .section-title { font-size: 1.4rem; }
    .section-desc { font-size: 0.9rem; }
    .section-tag { font-size: 0.7rem; padding: 0.25rem 0.6rem; }
    .scroll-container { padding: 0.6rem 0.6rem 2rem 0.6rem; gap: 0.8rem; }
    .game-card { flex: 0 0 160px; height: 280px; }
    .game-card:hover { flex: 0 0 200px; }
    .card-title { font-size: 1.1rem; }
    .card-info { font-size: 0.8rem; }
    .action-btn { padding: 0.4rem 1rem; font-size: 0.8rem; margin-top: 0.8rem; }
    .modal-content { margin: 10% auto; width: 99%; max-height: 75vh; border-radius: 12px; }
    .modal-header { padding: 1.2rem; }
    .close-modal { left: 0.6rem; top: 0.6rem; font-size: 1.1rem; width: 30px; height: 30px; }
    .modal-body { padding: 1rem; max-height: calc(75vh - 80px); font-size: 0.9rem; }
    .modal-title { font-size: 1.3rem; }
    .modal-section h3 { font-size: 0.95rem; margin-bottom: 0.6rem; padding-right: 0.8rem; }
    .modal-section ul li { font-size: 0.8rem; padding: 0.5rem 0; }
    .contact-info { padding: 0.8rem; }
    .cms-section { padding: 1rem; }
    .cms-btn { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
}
@media (max-width: 768px) {
    .scroll-container {
        justify-content: flex-start; /* Aligns items to start for scrolling */
        padding-right: 1rem; /* Space for RTL scrolling */
    }
    
    /* Ensure cards don't shrink */
    .game-card {
        flex-shrink: 0; 
    }
}

