/* ==========================================================================
   Homepage CSS - Code Intégral et Finalisé
   ========================================================================== */

/* ==========================================================================
   1. Hero Section
   ========================================================================== */
.hero {
    position: relative;
    height: 60vh;
    min-height: 320px;
    overflow: hidden;
    width: 100%;
    background: #0d2149;
    z-index: 1;
}
.hero-slides {
    position: relative;
    height: 100%;
    width: 100%;
}
.hero-slide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s cubic-bezier(.4,0,.2,1);
    z-index: 1;
    display: flex;
}
.hero-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}
.hero-slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    will-change: transform;
    z-index: 1;
    transition: transform 1.2s cubic-bezier(.4,0,.2,1);
}
.hero-slide.active .hero-slide-bg {
    animation: kenburns 7s linear forwards;
}
@keyframes kenburns {
    0% { transform: scale(1.0) translateX(0); }
    100% { transform: scale(1.1) translateX(2%); }
}
.hero-slide::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(to right, rgba(13,33,73,0.7) 10%, transparent 100%);
}
.hero-slide-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    max-width: 700px;
    padding: 0 8%;
    text-align: left;
}
.hero-title {
    font-family: 'Lora', serif;
    font-size: 2.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1.2rem;
    text-shadow: 0 2px 16px rgba(0,0,0,0.25);
}
.hero-subtitle {
    font-size: 1.3rem;
    color: #e0e6f6;
    margin-bottom: 2.2rem;
    text-shadow: 0 1px 8px rgba(0,0,0,0.18);
}
.hero .btn {
    width: fit-content;
    padding: 0.8em 2.2em;
    font-size: 1.1rem;
    border-radius: 2em;
    box-shadow: 0 2px 12px rgba(13,33,73,0.12);
}
.hero-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(13,33,73,0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 2rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 12px rgba(13,33,73,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-nav--prev { left: 2.5%; }
.hero-nav--next { right: 2.5%; }
.hero-nav:focus,
.hero-nav:hover {
    background: #1a2d4d;
    outline: none;
}
.hero-controls {
    position: absolute;
    bottom: 24px;
    left: 8%;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 24px;
}
.hero-progress-bar {
    width: 220px;
    height: 6px;
    background: rgba(255,255,255,0.18);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(13,33,73,0.10);
}
.hero-dots {
    display: flex;
    gap: 12px;
}
.hero-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: 2px solid #fff;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.hero-dot.active {
    background: #fff;
    border-color: #1a2d4d;
}
.hero-progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f7b733 0%, #fc4a1a 100%);
    border-radius: 3px;
    transition: width 0s;
}
.hero-progress-bar-fill.is-animating {
    animation: progressBarAnim 7s linear forwards;
}
@keyframes progressBarAnim {
    from { width: 0%; }
    to { width: 100%; }
}

/* ==========================================================================
   2. Section "À la Une" (Featured News)
   ========================================================================== */
.featured-news-section {
    background-color: var(--color-background-alt);
    padding-top: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
}
.news-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--spacing-xl);
    border-bottom: 1px solid #eee;
    padding-bottom: var(--spacing-m);
}
.news-section-header .section-title {
    margin: 0;
    text-align: left;
    font-size: 2.2rem;
}
.featured-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: var(--spacing-l);
}
.featured-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 450px;
    border-radius: var(--radius);
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.featured-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
}
.featured-card:hover .featured-card__bg-image {
    transform: scale(1.05);
}
.featured-card__bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: transform 0.4s ease;
}
.featured-card__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(13, 33, 73, 0.95) 15%, rgba(13, 33, 73, 0.4) 50%, rgba(13, 33, 73, 0.1) 100%);
    z-index: 2;
}
.featured-card__content {
    position: relative;
    z-index: 3;
    padding: var(--spacing-m);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.featured-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.featured-card__category {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}
.featured-card__bookmark-btn,
.featured-card__share-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}
.featured-card__bookmark-btn:hover,
.featured-card__share-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}
.featured-card__bookmark-btn svg,
.featured-card__share-btn svg {
    width: 20px;
    height: 20px;
}
.featured-card__body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: var(--spacing-m);
}
.featured-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}
.featured-card__excerpt {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    margin-top: var(--spacing-s);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0;
    max-height: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.featured-card:hover .featured-card__excerpt {
    opacity: 1;
    max-height: 100px;
    visibility: visible;
}
.featured-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-m);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    font-weight: 500;
}
.featured-card__author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.featured-card__author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.9);
    padding: 2px;
}

/* Carte Calendrier Événements */
#event-calendar-card {
    position: relative;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    padding: var(--spacing-l);
    cursor: default;
    background-size: cover;
    background-position: center;
    background-image: url('https://images.unsplash.com/photo-1522202176988-66273c2fd55f?q=80&w=1742&auto=format&fit=crop');
    transition: all 0.5s ease-in-out;
}
#event-calendar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: var(--radius);
    transition: background 0.8s ease;
}
#event-calendar-card.color-scheme-1::before { background: linear-gradient(to top, rgba(13, 33, 73, 0.95), rgba(13, 33, 73, 0.75)); }
#event-calendar-card.color-scheme-2::before { background: linear-gradient(to top, rgba(8, 63, 32, 0.95), rgba(27, 94, 32, 0.75)); }
#event-calendar-card.color-scheme-3::before { background: linear-gradient(to top, rgba(99, 15, 6, 0.95), rgba(191, 54, 12, 0.75)); }
#event-calendar-card.color-scheme-4::before { background: linear-gradient(to top, rgba(69, 39, 160, 0.95), rgba(103, 58, 183, 0.75)); }
#event-calendar-card > * {
    position: relative;
    z-index: 2;
}
.calendar-card__header {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    width: 100%;
    padding-bottom: var(--spacing-m);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.calendar-card__date {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: var(--spacing-l) 0;
    color: #fff;
    line-height: 1;
}
.calendar-card__day {
    font-size: 5rem;
    font-weight: 700;
    font-family: var(--font-heading);
}
.calendar-card__month {
    font-size: 1.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: -10px;
}
.calendar-card__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-s);
    width: 100%;
}
.calendar-card__type {
    background-color: var(--color-accent);
    color: var(--color-primary-dark);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 15px;
    text-transform: uppercase;
}
.calendar-card__title {
    font-family: var(--font-body);
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    margin: 0;
    min-height: 62px;
    display: flex;
    align-items: center;
}
.calendar-card__link {
    font-weight: 600;
    color: var(--color-accent);
    margin-top: var(--spacing-m);
    text-decoration: none;
    font-size: 0.9rem;
}
.calendar-card__link:hover {
    text-decoration: underline;
}
@keyframes blink-effect {
  50% { opacity: 0.3; }
}
.calendar-card__date.is-blinking {
  animation: blink-effect 0.6s ease-in-out;
}

/* ==========================================================================
   3. Hub Numérique (Online Services)
   ========================================================================== */
.online-services-section{
    background-color:var(--color-background-alt)
}
.services-title{
    text-align:center;
    font-size:2.5rem;
    font-weight:300;
    letter-spacing:2px;
    color:var(--color-text-light);
    margin-bottom:var(--spacing-l);
    position:relative;
    padding-bottom:var(--spacing-m)
}
.services-title:after{
    content:'';
    position:absolute;
    bottom:0;
    left:50%;
    transform:translateX(-50%);
    width:80px;
    height:2px;
    background-color:var(--color-accent)
}
.services-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
    gap:var(--spacing-l)
}
.service-card{
    --service-color:var(--color-primary-blue);
    background:var(--color-background);
    border-radius:var(--radius);padding:var(--spacing-m);
    border-bottom:4px solid var(--service-color);
    box-shadow:var(--shadow);
    display:flex;
    align-items:center;
    text-align:left;
    position:relative;
    transition:var(--transition)
}
.service-card:hover{
    background:var(--service-color);
    color:#fff;
    transform:translateY(-5px)
}
.service-card:hover .service-card__icon,
.service-card:hover .service-card__title,
.service-card:hover .service-card__description{
    color:#fff
}
.service-card__icon{
    font-size:28px;
    width:38px;
    height:38px;
    line-height:38px;
    text-align:center;
    margin-right:var(--spacing-m);
    flex-shrink:0;
    color:var(--service-color);
    transition:var(--transition)
}
.service-card__text{
    display:flex;
    flex-direction:column;
    justify-content:center;
    min-height:42px
}
.service-card__title{
    font-family:var(--font-body);
    font-size:1rem;
    color:var(--color-text-dark);
    font-weight:500;
    transition:var(--transition)
}
.service-card__description{
    display:none;
    font-size:.85rem;
    line-height:1.4
}
.service-card:hover .service-card__title{
    display:none
}
.service-card:hover .service-card__description{
    display:block
}

/* ==========================================================================
   4. Section Profils (Access by Training)
   ========================================================================== */
#profils {
    background-color: #f8f9fa;
}
.profile-grid {
    display: grid;
    gap: var(--spacing-l, 2rem);
    grid-template-columns: 1fr;
}
.profile-card {
    position: relative;
    height: 320px;
    border-radius: var(--radius, 12px);
    overflow: hidden;
    box-shadow: var(--shadow-light, 0 4px 12px rgba(0,0,0,0.08));
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.profile-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,0.12));
}
.profile-card__bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s ease;
}
.profile-card:hover .profile-card__bg {
    transform: scale(1.05);
}
.profile-card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--spacing-m, 1.5rem);
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    transition: opacity 0.3s ease;
}
.profile-card__title {
    font-family: var(--font-display, 'Lora', serif);
    font-size: 1.4rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
    color: white;
}
.profile-card__cta {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-accent);
    opacity: 1;
}
.profile-card__menu-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(13, 33, 73, 0.95);
    backdrop-filter: blur(5px);
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-m, 1.5rem);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
}
.profile-card.active .profile-card__menu-overlay {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}
.profile-card.active .profile-card__content {
    opacity: 0;
}
.profile-menu__close-btn {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}
.profile-menu__close-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}
.profile-menu__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-primary, #e74c3c);
    padding-bottom: 0.5rem;
    color: white;
}
.profile-menu__list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}
.profile-menu__list li {
    margin-bottom: 1rem;
}
.profile-menu__list a {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    position: relative;
}
.profile-menu__list a::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: white;
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}
.profile-menu__list a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Correction : alignement à droite du texte arabe dans les cartes actualités */
.featured-card * {
  unicode-bidi: plaintext;
}
.featured-card [lang="ar"],
.featured-card [dir="rtl"],
.featured-card .ar-text,
.featured-card .text-rtl {
  text-align: right !important;
  direction: rtl !important;
  unicode-bidi: plaintext;
}

/* ==========================================================================
   5. Responsive Media Queries
   ========================================================================== */

@media (min-width: 640px) {
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .profile-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .featured-grid,
    .profile-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .hero {
        height: 70vh;
    }
    .hero-slide-content {
        max-width: 90vw;
        padding: 0 4%;
    }
    .hero-title {
        font-size: 2.1rem;
    }
    .hero-subtitle {
        font-size: 1.05rem;
    }
    .hero-controls {
        left: 4%;
    }
}
@media (max-width: 600px) {
    .hero-title {
        font-size: 1.8rem;
    }
    .hero-subtitle {
        font-size: 0.95rem;
    }
    .hero-controls {
        left: 2%;
        width: 90vw;
    }
    .hero-progress-bar {
        min-width: 120px;
        flex-grow: 1;
    }
}