/**
 * Alert Banners - Frontend Styles
 * 
 * @package Alert_Banners
 * @version 1.0.0
 * 
 * Styles pour les bandeaux d'alerte et modales
 * Compatible RGAA / WCAG 2.1 AA
 */

/* ==========================================================================
   Variables CSS
   ========================================================================== */

:root {
    --alert-banner-text-color: #F8F8F8;
    --alert-banner-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    --alert-banner-font-size: 15px;
    --alert-banner-padding: 12px 20px;
    --alert-banner-gap: 10px;
    
    /* Modal */
    --alert-modal-overlay-color: rgba(17, 28, 51, 0.9);
    --alert-modal-text-color: #111C33;
}

/* ==========================================================================
   BANDEAU - Base
   ========================================================================== */

.alert-banner {
    width: 100%;
    padding: var(--alert-banner-padding);
    box-sizing: border-box;
}

.alert-banner__content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--alert-banner-gap);
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================================================
   BANDEAU - Icône
   ========================================================================== */

.alert-banner__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.alert-banner__icon svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   BANDEAU - Message
   ========================================================================== */

.alert-banner__message {
    color: var(--alert-banner-text-color);
    font-size: var(--alert-banner-font-size);
    font-family: var(--alert-banner-font-family);
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

/* ==========================================================================
   BANDEAU - Bouton/Lien
   ========================================================================== */

.alert-banner__link {
    flex-shrink: 0;
    color: var(--alert-banner-text-color);
    font-size: var(--alert-banner-font-size);
    font-family: var(--alert-banner-font-family);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.alert-banner__link:hover,
.alert-banner__link:focus {
    color: var(--alert-banner-text-color);
    opacity: 0.85;
    text-decoration: underline;
}

.alert-banner__link:focus {
    outline: 2px solid var(--alert-banner-text-color);
    outline-offset: 2px;
}

.alert-banner__link:focus:not(:focus-visible) {
    outline: none;
}

.alert-banner__link:focus-visible {
    outline: 2px solid var(--alert-banner-text-color);
    outline-offset: 2px;
}

/* ==========================================================================
   BANDEAU - Variantes par établissement
   ========================================================================== */

.alert-banner--epsytera {
    background-color: #002149;
}

.alert-banner--cpn {
    background-color: #008298;
}

.alert-banner--ravenel {
    background-color: #747C2B;
}

/* ==========================================================================
   MODAL - Structure
   ========================================================================== */

.alert-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.alert-modal.is-open {
    display: flex;
}

/* ==========================================================================
   MODAL - Overlay
   ========================================================================== */

.alert-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--alert-modal-overlay-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.alert-modal.is-visible .alert-modal__overlay {
    opacity: 1;
}

/* ==========================================================================
   MODAL - Container
   ========================================================================== */

.alert-modal__container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 850px;
    max-height: 90vh;
    margin: 20px;
    overflow-y: auto;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.alert-modal.is-visible .alert-modal__container {
    transform: translateY(0);
    opacity: 1;
}

/* ==========================================================================
   MODAL - Dialog
   ========================================================================== */

.alert-modal__dialog {
    position: relative;
    background: var(--modal-bg, #EDF6FB);
    border-radius: 26px;
    border-left: 16px solid var(--modal-border, #667A92);
    border-top: 1px solid var(--modal-border, #667A92);
    border-right: 1px solid var(--modal-border, #667A92);
    border-bottom: 1px solid var(--modal-border, #667A92);
    padding: 40px 60px 50px;
}

/* ==========================================================================
   MODAL - Bouton Fermer
   ========================================================================== */

.alert-modal__close {
    position: absolute;
    top: 33px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 16px;
    background: transparent;
    border: 1px solid var(--modal-color, #002149);
    border-radius: 11px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-family: var(--alert-banner-font-family);
    font-size: 15px;
    font-weight: 600;
    color: var(--modal-color, #002149);
}

.alert-modal__close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.alert-modal__close:focus {
    outline: 2px solid var(--modal-color, #002149);
    outline-offset: 2px;
}

.alert-modal__close:focus:not(:focus-visible) {
    outline: none;
}

.alert-modal__close:focus-visible {
    outline: 2px solid var(--modal-color, #002149);
    outline-offset: 2px;
}

.alert-modal__close svg {
    width: 12px;
    height: 12px;
}

/* ==========================================================================
   MODAL - Header
   ========================================================================== */

.alert-modal__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding-right: 200px;
}

.alert-modal__icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.alert-modal__icon svg {
    width: 60px;
    height: 60px;
}

.alert-modal__title {
    margin: 0;
    color: var(--modal-color, #002149);
    font-size: 24px;
    font-family: var(--alert-banner-font-family);
    font-weight: 700;
    line-height: 1.3;
}

/* ==========================================================================
   MODAL - Contenu
   ========================================================================== */

.alert-modal__content {
    color: var(--alert-modal-text-color);
    font-size: 16px;
    font-family: var(--alert-banner-font-family);
    font-weight: 600;
    line-height: 1.36;
}

.alert-modal__content p {
    margin: 0 0 1em;
}

.alert-modal__content p:last-child {
    margin-bottom: 0;
}

.alert-modal__content a {
    color: var(--modal-color, #002149);
    text-decoration: underline;
}

.alert-modal__content a:hover {
    text-decoration: none;
}

/* ==========================================================================
   MODAL - Body scroll lock
   ========================================================================== */

body.alert-modal-open {
    overflow: hidden !important;
}

/* ==========================================================================
   Accessibilité - Screen reader
   ========================================================================== */

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Support reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .alert-banner__link,
    .alert-modal__overlay,
    .alert-modal__container,
    .alert-modal__close {
        transition: none;
    }
}

/* ==========================================================================
   Responsive - Tablette
   ========================================================================== */

@media screen and (max-width: 1024px) {
    .alert-banner {
        padding: 12px 16px;
    }
    
    .alert-banner__content {
        gap: 8px;
    }
    
    .alert-modal__dialog {
        padding: 30px 40px 40px;
    }
    
    .alert-modal__header {
        padding-right: 150px;
    }
    
    .alert-modal__close {
        top: 20px;
        right: 20px;
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Responsive - Mobile
   ========================================================================== */

@media screen and (max-width: 768px) {
    .alert-banner {
        padding: 10px 12px;
    }
    
    .alert-banner__content {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .alert-banner__message {
        font-size: 14px;
        flex: 1 1 100%;
        order: 2;
    }
    
    .alert-banner__icon {
        order: 1;
    }
    
    .alert-banner__link {
        order: 3;
        font-size: 14px;
    }
    
    /* Modal mobile */
    .alert-modal__container {
        margin: 10px;
        max-height: 95vh;
    }
    
    .alert-modal__dialog {
        padding: 20px 20px 30px;
        border-radius: 16px;
        border-left-width: 8px;
    }
    
    .alert-modal__close {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 20px;
        margin-left: auto;
    }
    
    .alert-modal__header {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 0;
        gap: 16px;
    }
    
    .alert-modal__icon {
        width: 48px;
        height: 48px;
    }
    
    .alert-modal__icon svg {
        width: 48px;
        height: 48px;
    }
    
    .alert-modal__title {
        font-size: 20px;
    }
    
    .alert-modal__content {
        font-size: 14px;
    }
}

/* ==========================================================================
   Responsive - Petit mobile
   ========================================================================== */

@media screen and (max-width: 480px) {
    .alert-banner__content {
        flex-direction: column;
        text-align: center;
    }
    
    .alert-banner__message {
        flex: none;
    }
    
    .alert-modal__close span {
        display: none;
    }
    
    .alert-modal__close {
        padding: 10px;
    }
}

/* ==========================================================================
   Intégration Elementor
   ========================================================================== */

.elementor-widget-shortcode .alert-banner,
.elementor-shortcode .alert-banner {
    margin: 0;
    padding: 12px 20px;
}

.elementor-section-full_width .alert-banner {
    width: 100%;
}

.elementor-section.elementor-section-boxed > .elementor-container .alert-banner__content {
    max-width: none;
}

.elementor-widget-shortcode .alert-banner__link,
.elementor-shortcode .alert-banner__link {
    color: var(--alert-banner-text-color) !important;
    text-decoration: underline !important;
}

.elementor-widget-shortcode .alert-banner__link:hover,
.elementor-shortcode .alert-banner__link:hover {
    color: var(--alert-banner-text-color) !important;
}
