/* -------------------------------------------------------------------------- 
   MRGIS - Unified Main Stylesheet
   Combines home, secretariat, advisory, partner-countries styles with clean dedup
   -------------------------------------------------------------------------- */

/* ===== CSS VARIABLES (consistent & complete) ===== */
:root {
    --primary: #1a5f7a;
    --primary-dark: #0d4a63;
    --secondary: #2a9d8f;
    --accent: #e76f51;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 25px 40px -14px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-card: 24px;
    --transition: all 0.3s ease;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: #f5f7fa;
}

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

figcaption {
    font-size: 0.9rem;
    color: var(--gray);
    margin-top: 0.5rem;
    font-style: italic;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}
.btn-secondary:hover {
    background-color: #238277;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ===== HEADER & NAVIGATION (fixed + responsive) ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.logo i {
    color: var(--secondary);
}
.logo img {
    height: 42px;
    width: auto;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}
.nav-links a {
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
    color: var(--dark);
    transition: color 0.2s;
}
.nav-links a:hover {
    color: var(--primary);
}
.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--secondary);
    bottom: 0;
    left: 0;
    transition: var(--transition);
}
.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
}

/* ===== SECTION GENERICS ===== */
.section {
    padding: 5rem 0;
}
.section-title {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}
.section-title::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 4px;
    background-color: var(--secondary);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

/* ===== HERO SECTION (homepage) ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), 
                url('https://img.lemde.fr/2024/04/23/0/0/3951/2635/556/0/75/0/48a157d_5273810-01-06.jpg') no-repeat center center/cover;
    color: white;
    text-align: center;
    padding-top: 80px;
}
.hero-content {
    max-width: 800px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}
.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* ===== THEMATIC AREAS (home) ===== */
.thematic-areas {
    background-color: var(--light-gray);
}
.thematic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}
.thematic-card {
    background-color: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.thematic-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.thematic-icon {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 1.5rem;
}
.thematic-card h3 {
    color: var(--primary);
    font-size: 1.3rem;
}

/* ===== ABOUT SECTION (home) ===== */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.about-text {
    font-size: 1.1rem;
}
.about-image {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* ===== PROJECT SECTION (home) ===== */
.project-section {
    background-color: var(--light-gray);
}
.project-card {
    background-color: white;
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}
.status-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
}
.status-completed {
    background-color: #d4edda;
    color: #155724;
}
.project-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.detail-item {
    background-color: var(--light-gray);
    padding: 1.2rem;
    border-radius: var(--radius);
}
.detail-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* ===== PARTNER COUNTRIES SECTION (home + partner page) ===== */
.countries-section {
    background-color: white;
}
.countries-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 3rem;
}
.countries-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.country-card {
    background-color: var(--light-gray);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}
.country-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    background-color: #e3f2fd;
}
.country-flag {
    font-size: 3rem;
    margin-bottom: 1rem;
    width: 80px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.country-name {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* ===== PEOPLE MODAL (used across site) ===== */
.universities-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 1rem;
}
.universities-modal.active {
    opacity: 1;
    visibility: visible;
}
.universities-content {
    background-color: white;
    border-radius: 28px;
    max-width: 1000px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    transform: translateY(20px);
    transition: var(--transition);
}
.universities-modal.active .universities-content {
    transform: translateY(0);
}
.universities-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
}
.universities-close:hover {
    color: var(--dark);
}
.universities-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.universities-flag {
    font-size: 3rem;
}
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.8rem;
    margin-top: 1rem;
}
.no-people-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

/* ===== SECRETARIAT PAGE STYLES ===== */
.secretariat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
    padding: 2rem 0 4rem;
}
.member-card {
    background: white;
    border-radius: 28px;
    transition: transform 0.25s ease, box-shadow 0.3s;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    overflow: hidden;
}
.member-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}
.card-inner {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.member-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eef5f7, #ffffff);
    padding: 4px;
    margin-bottom: 1rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}
.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.member-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 0.35rem;
}
.member-designation {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    background: #e6f4f1;
    display: inline-block;
    padding: 0.2rem 1rem;
    border-radius: 40px;
    margin-bottom: 0.8rem;
}
.member-university {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--gray);
    font-size: 0.85rem;
    background: #f8fafc;
    padding: 0.4rem 1rem;
    border-radius: 60px;
    width: fit-content;
    margin: 0 auto 1.2rem;
}
.view-detail-btn {
    background: transparent;
    border: 1.5px solid var(--secondary);
    color: var(--secondary);
    font-weight: 700;
    padding: 0.65rem 1.5rem;
    border-radius: 40px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 80%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.view-detail-btn:hover {
    background: var(--secondary);
    color: white;
}

/* ===== ADVISORY PAGE STYLES ===== */
.advisory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 3rem 0;
}
.advisory-card {
    background: white;
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.advisory-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}
.card-photo {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: var(--light-gray);
}
.card-photo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.advisory-card:hover .card-photo img {
    transform: scale(1.03);
}
.card-content {
    padding: 1.5rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.card-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.3rem;
}
.card-designation {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.75rem;
}
.card-organization {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gray);
    font-size: 0.9rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--light-gray);
}
.expertise-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.8rem 0 1rem;
}
.expertise-tag {
    background: var(--light-gray);
    padding: 0.2rem 0.7rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--primary-dark);
}
.card-footer {
    margin-top: auto;
    padding-top: 1rem;
}
.view-profile-btn {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1.2rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
}
.view-profile-btn:hover {
    background: var(--primary);
    color: white;
}

/* ===== PAGE HEADER (common for subpages) ===== */
.page-header {
    background: linear-gradient(120deg, #0a2e3b 0%, #145c6e 100%);
    color: white;
    padding: 140px 0 70px;
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}
.page-header h1 {
    font-size: 3.2rem;
    font-weight: 800;
}
.page-header p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 1rem auto 0;
    opacity: 0.9;
}

/* ===== COUNTRY DETAIL (partner page) ===== */
.country-section {
    margin-bottom: 4rem;
    background: white;
    border-radius: 32px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.country-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: white;
    border-bottom: 2px solid rgba(42, 157, 143, 0.2);
}
.country-title {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary);
}
.partner-badge {
    background: #eef2f5;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--secondary);
    margin-left: 1rem;
}
.person-card {
    background: white;
    border-radius: 28px;
    transition: 0.25s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
}
.person-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}
.person-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}
.person-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.person-name {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--primary-dark);
}
.person-designation {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    background: #e6f4f1;
    display: inline-block;
    padding: 0.2rem 1rem;
    border-radius: 40px;
}
.person-organization {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f8fafc;
    padding: 0.4rem 1rem;
    border-radius: 60px;
    width: fit-content;
    margin: 0.8rem auto 0;
}

/* ===== CONTACT SECTION ===== */
.contact-section {
    background-color: var(--light-gray);
}
.contact-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

/* ===== MODAL (overlay detail for people, secretariat, advisory) ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: 0.2s;
    padding: 1rem;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: white;
    border-radius: 40px;
    max-width: 880px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}
.modal-close {
    position: absolute;
    right: 1.5rem;
    top: 1.2rem;
    font-size: 1.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #8b9eb0;
}
.modal-header {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.8rem;
}
.modal-avatar img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
}
.modal-header-content h2 {
    font-size: 1.8rem;
    color: var(--primary);
}
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 20px;
    margin-bottom: 1rem;
}
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.link-item {
    background: #eef2f5;
    padding: 0.4rem 1rem;
    border-radius: 40px;
    font-size: 0.85rem;
    color: var(--primary);
    transition: 0.2s;
}
.link-item:hover {
    background: var(--secondary);
    color: white;
}

/* ===== LOADING STATES ===== */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-state, .error-state {
    text-align: center;
    padding: 4rem;
    background: white;
    border-radius: 32px;
}

/* ===== FOOTER ===== */
footer {
    background-color: var(--primary-dark);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-column h3 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    position: relative;
}
.footer-column h3::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 3px;
    background-color: var(--secondary);
    bottom: -8px;
    left: 0;
}
.footer-links {
    list-style: none;
}
.footer-links li {
    margin-bottom: 0.6rem;
}
.footer-links a {
    color: #ccc;
    transition: var(--transition);
}
.footer-links a:hover {
    color: white;
    padding-left: 5px;
}
.copyright {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    font-size: 0.85rem;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */
@media (max-width: 1200px) {
    .countries-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 1024px) {
    .advisory-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 992px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    .about-content {
        grid-template-columns: 1fr;
    }
    .countries-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: white;
        flex-direction: column;
        padding: 1rem 0;
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        gap: 0;
    }
    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    .nav-links li {
        margin: 0;
        text-align: center;
    }
    .nav-links a {
        display: block;
        padding: 1rem;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .section {
        padding: 3rem 0;
    }
    .people-grid,
    .secretariat-grid,
    .advisory-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .countries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .page-header h1 {
        font-size: 2.2rem;
    }
    .country-header {
        flex-wrap: wrap;
        padding: 1rem;
    }
    .modal-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
@media (max-width: 576px) {
    .hero h1 {
        font-size: 1.8rem;
    }
    .project-card {
        padding: 1.5rem;
    }
    .universities-content {
        padding: 1.5rem;
    }
    .countries-grid {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 0 1rem;
    }
    .card-name {
        font-size: 1.2rem;
    }
}