/* Research Portal - CSS Style Principal */

:root {
    --primary-color: #2563eb;
    --primary-light: #eff6ff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --sidebar-width: 280px;
    --navbar-height: 70px;
}

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar fixe */
.navbar {
    background-color: var(--white) !important;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.75rem 0;
    min-height: var(--navbar-height);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--gray-800) !important;
    text-decoration: none;
    margin-right: auto;
}

/* Logo et brand responsive - CORRIGÉ */
.logo-container-custom {
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.navbar-logo {
    width: 50px;
    height: auto;
    max-height: 45px;
}

.brand-text {
    font-size: 1.1rem;
    color: var(--gray-800);
    font-weight: 600;
}

.brand-text-full {
    display: inline;
}

.brand-text-short {
    display: none;
}

/* Responsive brand text - AJUSTÉ POUR MOBILE */
@media (max-width: 1200px) {
    .brand-text-full {
        display: none;
    }
    .brand-text-short {
        display: inline;
    }
    .brand-text {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .navbar-logo {
        width: 40px;
    }
    .brand-text {
        font-size: 0.9rem;
    }
    .logo-container-custom {
        margin-right: 0.5rem;
    }
}

/* Navigation */
.navbar-nav .nav-link {
    color: var(--gray-600) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s ease;
    border-radius: 6px;
    margin: 0 0.25rem;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
    background-color: var(--gray-50);
}

.dropdown-menu {
    border: 1px solid var(--gray-200);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0;
    background-color: var(--white);
    z-index: 1050;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--gray-700);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--primary-color);
}

/* Layout principal - STRUCTURE CORRIGÉE */
.main-layout {
    display: flex;
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
    flex: 1;
    position: relative;
}

/* Sidebar - POSITION FIXÉE */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    border-right: 1px solid var(--gray-200);
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    z-index: 100;
    box-shadow: 2px 0 4px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

/* Sidebar mobile - CORRIGÉ */
.sidebar-mobile-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    text-align: right;
}

.mobile-menu-btn {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    left: 1rem;
    z-index: 101;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
    background-color: #1d4ed8;
    transform: scale(1.05);
}

.mobile-menu-btn i {
    font-size: 1.2rem;
}

/* Contenu principal - MARGE CORRIGÉE */
.main-content {
    flex: 1;
    background-color: var(--gray-50);
    min-height: calc(100vh - var(--navbar-height) - 200px);
    padding: 1rem;
    padding-bottom: 300px; /* Espace pour le footer */
    width: 100%;
    position: relative;
    z-index: 1;
}

.main-content.with-sidebar {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}

/* Navigation sidebar */
.sidebar-nav {
    padding: 1.5rem 0;
}

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.sidebar-link:hover {
    background-color: var(--gray-50);
    color: var(--primary-color);
    text-decoration: none;
}

.sidebar-link.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-link i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

/* Groupes avec sous-menus */
.sidebar-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--gray-600);
    text-align: left;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    cursor: pointer;
}

.sidebar-group-toggle:hover {
    background-color: var(--gray-50);
    color: var(--primary-color);
}

.sidebar-group-toggle:focus {
    outline: none;
}

.sidebar-group-toggle i:first-child {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.sidebar-group-toggle .bi-chevron-down {
    transition: transform 0.2s ease;
}

.sidebar-submenu {
    background-color: var(--gray-50);
    border-left: 2px solid var(--gray-200);
    margin-left: 1.5rem;
}

.sidebar-sublink {
    display: block;
    padding: 0.5rem 1.5rem 0.5rem 2rem;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-weight: 400;
}

.sidebar-sublink:hover {
    background-color: var(--white);
    color: var(--primary-color);
    text-decoration: none;
}

/* Footer corrigé avec grille simple */
.footer {
    background-color: var(--white) !important;
    border-top: 1px solid var(--gray-200);
    padding: 2rem 0;
    margin-top: auto !important;
    position: relative;
    z-index: 10;
    width: 100%;
}

.footer .container {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

/* Footer avec sidebar - décalage pour éviter le chevauchement */
.footer-with-sidebar {
    margin-left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
    max-width: calc(100% - var(--sidebar-width)) !important;
}

.footer-title {
    color: var(--gray-800);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Grille partenaires simplifiée et responsive */
.partners-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.partner-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 80px;
}

.partner-logo:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.partner-logo img {
    max-height: 45px;
    width: auto;
    object-fit: contain;
}

/* Responsive partners grid */
@media (max-width: 768px) {
    .partners-grid {
        gap: 1rem;
    }

    .partner-logo {
        min-width: 70px;
        padding: 0.375rem;
    }

    .partner-logo img {
        max-height: 35px;
    }
}

/* Cards */
.card {
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card-header {
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    color: var(--gray-900);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Boutons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border: 1px solid;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    color: var(--white);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.btn-outline-secondary {
    color: var(--gray-600);
    border-color: var(--gray-300);
    background-color: transparent;
}

.btn-outline-secondary:hover {
    background-color: var(--gray-600);
    border-color: var(--gray-600);
    color: var(--white);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-success {
    background-color: #059669;
    border-color: #059669;
    color: var(--white);
}

.btn-success:hover {
    background-color: #047857;
    border-color: #047857;
    color: var(--white);
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
    padding: 4rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.hero-title {
    color: var(--gray-900);
    font-weight: 700;
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    color: var(--gray-600);
    font-size: 1.25rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Section actualités */
.news-section {
    padding: 3rem 0;
    background-color: var(--white);
}

.section-title {
    color: var(--gray-900);
    font-weight: 600;
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.news-card {
    transition: all 0.2s ease;
    border: 1px solid var(--gray-200);
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.news-meta {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

/* Features grid */
.features-section {
    padding: 3rem 0;
    background-color: var(--gray-50);
}

.feature-card {
    text-align: center;
    padding: 2rem 1.5rem;
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    transition: all 0.2s ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background-color: var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

/* Alertes */
.alert {
    border: none;
    border-radius: 8px;
    border-left: 4px solid;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
}

.alert-info {
    background-color: #eff6ff;
    border-left-color: var(--primary-color);
    color: #1e40af;
}

.alert-success {
    background-color: #f0fdf4;
    border-left-color: #059669;
    color: #047857;
}

.alert-warning {
    background-color: #fffbeb;
    border-left-color: #d97706;
    color: #92400e;
}

.alert-danger {
    background-color: #fef2f2;
    border-left-color: #dc2626;
    color: #991b1b;
}

/* Formulaires */
.form-control {
    border-radius: 8px;
    border: 1px solid var(--gray-300);
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* Tables */
.table {
    background-color: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table th {
    background-color: var(--gray-50);
    font-weight: 600;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-200);
}

.table td {
    border-bottom: 1px solid var(--gray-100);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.hero-graphic {
    animation: float 3s ease-in-out infinite;
}

/* Responsive - MOBILE CORRIGÉ */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1040;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content.with-sidebar {
        margin-left: 0;
        width: 100%;
        padding: 0.5rem;
    }

    .footer-with-sidebar {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* Ajustement pour éviter que la navbar cache le contenu sur mobile */
    .main-content {
        padding-top: 1.5rem;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .feature-card {
        margin-bottom: 1.5rem;
    }

    .main-content {
        padding: 1rem 0.5rem;
    }

    /* Ajustement supplémentaire pour très petits écrans */
    .navbar {
        padding: 0.5rem 0;
    }

    .mobile-menu-btn {
        top: calc(var(--navbar-height) + 0.5rem);
    }
}

@media (min-width: 992px) {
    .mobile-menu-btn {
        display: none;
    }

    .sidebar-mobile-header {
        display: none;
    }
}

/* Utilitaires */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary-light {
    background-color: var(--primary-light) !important;
}

.text-muted {
    color: var(--gray-500) !important;
}

.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-center {
    justify-content: center !important;
}

.gap-3 {
    gap: 1rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.h-100 {
    height: 100% !important;
}

/* Thème sombre global */
body.dark-theme {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
}

body.dark-theme .navbar {
    background-color: #2d2d2d !important;
    border-bottom-color: #404040 !important;
}

body.dark-theme .sidebar {
    background-color: #2d2d2d !important;
    border-right-color: #404040 !important;
}

body.dark-theme .main-content {
    background-color: #1a1a1a !important;
}

body.dark-theme .card {
    background-color: #2d2d2d !important;
    border-color: #404040 !important;
}

body.dark-theme .card-header {
    background-color: #404040 !important;
    border-color: #404040 !important;
}

body.dark-theme .form-control,
body.dark-theme .form-select {
    background-color: #404040 !important;
    border-color: #606060 !important;
    color: #ffffff !important;
}

body.dark-theme .btn-outline-primary,
body.dark-theme .btn-outline-secondary,
body.dark-theme .btn-outline-danger {
    border-color: #606060 !important;
    color: #ffffff !important;
}

body.dark-theme .dropdown-menu {
    background-color: #2d2d2d !important;
    border-color: #404040 !important;
}

body.dark-theme .dropdown-item {
    color: #ffffff !important;
}

body.dark-theme .dropdown-item:hover {
    background-color: #404040 !important;
}

body.dark-theme .sidebar-link {
    color: #cccccc !important;
}

body.dark-theme .sidebar-link:hover {
    background-color: #404040 !important;
    color: #ffffff !important;
}

body.dark-theme .navbar-nav .nav-link {
    color: #cccccc !important;
}

body.dark-theme .navbar-nav .nav-link:hover {
    color: #ffffff !important;
    background-color: #404040 !important;
}

body.dark-theme .footer {
    background-color: #2d2d2d !important;
    border-top-color: #404040 !important;
}

body.dark-theme .partner-logo-simple {
    background-color: #404040 !important;
    border-color: #606060 !important;
}

body.dark-theme .table {
    background-color: #2d2d2d !important;
}

body.dark-theme .table th {
    background-color: #404040 !important;
    color: #ffffff !important;
}

body.dark-theme .table td {
    border-color: #404040 !important;
    color: #ffffff !important;
}

body.dark-theme .alert-info {
    background-color: #1e3a8a !important;
    color: #bfdbfe !important;
}

body.dark-theme .alert-success {
    background-color: #065f46 !important;
    color: #86efac !important;
}

body.dark-theme .alert-warning {
    background-color: #92400e !important;
    color: #fbbf24 !important;
}

body.dark-theme .alert-danger {
    background-color: #991b1b !important;
    color: #fca5a5 !important;
}

body.dark-theme .mobile-menu-btn {
    background-color: #404040 !important;
    color: #ffffff !important;
}

body.dark-theme .mobile-menu-btn:hover {
    background-color: #606060 !important;
}
