:root {
    /* Palette Moderne : Bleu & Orangé */
    --primary: #1e3a8a; /* Bleu profond */
    --primary-light: #3b82f6; /* Bleu vif */
    --accent: #f97316; /* Orangé moderne */
    --accent-hover: #ea580c; /* Orangé foncé */
    --dark: #0f172a;
    --light: #f8fafc;
    --success: #10b981;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--light);
    color: var(--dark);
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0,0,0,0.05);
    padding: 1rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
}

.navbar-brand img {
    width: auto;
    object-fit: contain;
}

.navbar-brand .plateforme-subtitle {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}

.nav-link {
    font-weight: 500;
    color: var(--primary);
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--accent);
}

.btn-connexion {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.btn-connexion:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
    color: white;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 180px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Ligne sécurisée : encodage URL du SVG pour éviter tout bug HTML */
    background: url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='2' cy='2' r='2' fill='rgba(255,255,255,0.05)'/%3E%3C/svg%3E");
    z-index: 0;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    animation: fadeInUp 0.6s ease-out;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 2rem;
    color: #e2e8f0;
}

.search-wrapper {
    max-width: 550px;
    margin: 0 auto;
}

.search-box {
    background: white;
    border-radius: 50px;
    padding: 6px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.search-box input {
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    background: transparent;
    font-size: 1.05rem;
}

.search-box input:focus {
    outline: none;
    box-shadow: none;
}

.search-box button {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 50px;
    padding: 10px 30px;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.4);
}

/* Sections Global */
.section-padding {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--primary);
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

.section-title.text-start::after {
    left: 0;
    transform: none;
}

.section-subtitle {
    text-align: center;
    color: #64748b;
    margin-top: 1rem;
    margin-bottom: 3.5rem;
    font-size: 1.1rem;
}

/* Formations Cards */
.formation-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.03);
}

.formation-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(30, 58, 138, 0.12);
}

.card-image {
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #f1f5f9;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.3s;
}

.formation-card:hover .card-image img {
    transform: scale(1.08);
}

.card-image img.loading {
    filter: blur(10px);
}

/* Badge Animé, Petit et en Haut à Droite */
@keyframes pulse-badge {
    0% { transform: scale(1); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
    50% { transform: scale(1.08); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
    100% { transform: scale(1); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
}

.status-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
    text-align: center;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: inline-block;
    white-space: nowrap;
    animation: pulse-badge 2s infinite ease-in-out;
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.formation-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.formation-intitule {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.formation-info {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.info-item {
    flex: 1;
    text-align: center;
}

.info-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.info-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
    margin-top: 5px;
}

.organisme {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #cbd5e1;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.actions-wrapper {
    margin-top: auto;
    padding-top: 1rem;
}

.btn-details {
    width: 100%;
    background: rgba(30, 58, 138, 0.05);
    border: 1px solid rgba(30, 58, 138, 0.1);
    color: var(--primary);
    border-radius: 12px;
    padding: 12px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-details:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.2);
}

.btn-inscrire-card {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: white;
    font-weight: 700;
    border-radius: 12px;
    padding: 12px;
    transition: all 0.3s ease;
}

.btn-inscrire-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.3);
    color: white;
}

/* Section Bureau */
.bureau-section {
    background: white;
}

.bureau-image-wrapper {
    position: relative;
    border-radius: 20px;
    padding: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.bureau-image-wrapper img {
    border-radius: 15px;
    width: 100%;
    height: auto;
    display: block;
    border: 4px solid white;
}

.president-box {
    background: linear-gradient(135deg, rgba(30,58,138,0.03), rgba(30,58,138,0.08));
    border-left: 5px solid var(--accent);
}

/* Modal */
.modal-full-image {
    max-height: 50vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 12px;
    margin: 0 auto;
}

.modal-body {
    max-height: 80vh;
    overflow-y: auto;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.custom-pagination .page-item .page-link {
    color: var(--primary);
    border: none;
    margin: 0 5px;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.custom-pagination .page-item.active .page-link {
    background-color: var(--accent);
    color: white;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.custom-pagination .page-item .page-link:hover:not(.active) {
    background-color: var(--primary-light);
    color: white;
    transform: translateY(-2px);
}

.custom-pagination .page-item.disabled .page-link {
    color: #cbd5e1;
    background-color: white;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Footer */
.footer {
    background: var(--dark);
    color: white;
    padding: 70px 0 20px;
    position: relative;
    border-top: 5px solid var(--primary);
}

.footer h5 {
    font-weight: 800;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 10px;
    color: white;
}

.footer h5::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

.footer a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s ease, padding-left 0.3s ease;
    display: inline-block;
}

.footer a:hover { 
    color: var(--accent);
    padding-left: 6px;
}

.social-icons a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    margin-right: 10px;
    transition: all 0.3s;
    color: white;
}

.social-icons a:hover {
    background: var(--accent);
    transform: translateY(-3px);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-animate {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

@media (max-width: 768px) {
    .hero { padding: 160px 15px 60px; }
    .hero h1 { font-size: 2rem; }
    .modal-full-image { max-height: 40vh; }
}