/* ================================================
   SYSTÈME D'ALERTES - Cover AR
   ================================================ */

/* Variables CSS pour les alertes */
:root {
    --alert-border-radius: 8px;
    --alert-padding: 1rem;
    --alert-margin: 1rem 0;
    --alert-font-size: 0.875rem;
    --alert-line-height: 1.5;
    --alert-icon-size: 1.25rem;
    --alert-close-size: 1.5rem;
    --alert-animation-duration: 0.3s;
    --alert-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ================================================
   CLASSE DE BASE POUR LES ALERTES
   ================================================ */

.alert {
    position: relative;
    padding: var(--alert-padding);
    margin: var(--alert-margin);
    border-radius: var(--alert-border-radius);
    font-size: var(--alert-font-size);
    line-height: var(--alert-line-height);
    border: 1px solid transparent;
    box-shadow: var(--alert-shadow);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: alertFadeIn var(--alert-animation-duration) ease-out;
}

.alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-title {
    font-weight: 600;
    margin: 0;
    font-size: 1rem;
}

.alert-message {
    margin: 0;
}

.alert-icon {
    width: var(--alert-icon-size);
    height: var(--alert-icon-size);
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* ================================================
   BOUTON DE FERMETURE
   ================================================ */

.alert-close {
    background: none;
    border: none;
    font-size: var(--alert-close-size);
    cursor: pointer;
    padding: 0;
    margin: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    width: var(--alert-close-size);
    height: var(--alert-close-size);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.alert-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.1);
}

.alert-close:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ================================================
   TYPES D'ALERTES
   ================================================ */

/* Alerte de succès */
.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-success .alert-icon {
    color: #28a745;
}

.alert-success .alert-close:hover {
    background-color: rgba(21, 87, 36, 0.1);
}

/* Alerte d'erreur */
.alert-error,
.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-error .alert-icon,
.alert-danger .alert-icon {
    color: #dc3545;
}

.alert-error .alert-close:hover,
.alert-danger .alert-close:hover {
    background-color: rgba(114, 28, 36, 0.1);
}

/* Alerte d'avertissement */
.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-warning .alert-icon {
    color: #ffc107;
}

.alert-warning .alert-close:hover {
    background-color: rgba(133, 100, 4, 0.1);
}

/* Alerte d'information */
.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.alert-info .alert-icon {
    color: #17a2b8;
}

.alert-info .alert-close:hover {
    background-color: rgba(12, 84, 96, 0.1);
}

/* Alerte primaire */
.alert-primary {
    background-color: #d1ecf1;
    color: #004085;
    border-color: #bee5eb;
}

.alert-primary .alert-icon {
    color: #007bff;
}

.alert-primary .alert-close:hover {
    background-color: rgba(0, 64, 133, 0.1);
}

/* Alerte secondaire */
.alert-secondary {
    background-color: #f8f9fa;
    color: #383d41;
    border-color: #dee2e6;
}

.alert-secondary .alert-icon {
    color: #6c757d;
}

.alert-secondary .alert-close:hover {
    background-color: rgba(56, 61, 65, 0.1);
}

/* ================================================
   VARIANTES DE TAILLE
   ================================================ */

.alert-sm {
    padding: 0.75rem;
    font-size: 0.8125rem;
}

.alert-sm .alert-icon {
    width: 1rem;
    height: 1rem;
}

.alert-sm .alert-close {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1.25rem;
}

.alert-lg {
    padding: 1.5rem;
    font-size: 1rem;
}

.alert-lg .alert-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.alert-lg .alert-close {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1.75rem;
}

/* ================================================
   ALERTES AVEC BORDURE
   ================================================ */

.alert-bordered {
    border-width: 2px;
    border-style: solid;
}

.alert-bordered.alert-success {
    border-color: #28a745;
}

.alert-bordered.alert-error,
.alert-bordered.alert-danger {
    border-color: #dc3545;
}

.alert-bordered.alert-warning {
    border-color: #ffc107;
}

.alert-bordered.alert-info {
    border-color: #17a2b8;
}

.alert-bordered.alert-primary {
    border-color: #007bff;
}

.alert-bordered.alert-secondary {
    border-color: #6c757d;
}

/* ================================================
   ALERTES AVEC BORDURE GAUCHE
   ================================================ */

.alert-left-border {
    border-left: 4px solid;
    border-radius: 0 var(--alert-border-radius) var(--alert-border-radius) 0;
}

.alert-left-border.alert-success {
    border-left-color: #28a745;
}

.alert-left-border.alert-error,
.alert-left-border.alert-danger {
    border-left-color: #dc3545;
}

.alert-left-border.alert-warning {
    border-left-color: #ffc107;
}

.alert-left-border.alert-info {
    border-left-color: #17a2b8;
}

.alert-left-border.alert-primary {
    border-left-color: #007bff;
}

.alert-left-border.alert-secondary {
    border-left-color: #6c757d;
}

/* ================================================
   ALERTES SOLIDES
   ================================================ */

.alert-solid {
    color: white;
    border: none;
}

.alert-solid.alert-success {
    background-color: #28a745;
}

.alert-solid.alert-error,
.alert-solid.alert-danger {
    background-color: #dc3545;
}

.alert-solid.alert-warning {
    background-color: #ffc107;
    color: #212529;
}

.alert-solid.alert-info {
    background-color: #17a2b8;
}

.alert-solid.alert-primary {
    background-color: #007bff;
}

.alert-solid.alert-secondary {
    background-color: #6c757d;
}

.alert-solid .alert-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.alert-solid.alert-warning .alert-close:hover {
    background-color: rgba(33, 37, 41, 0.2);
}

/* ================================================
   CONTENEUR D'ALERTES
   ================================================ */

.alerts-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: 100%;
}

.alerts-container .alert {
    margin-bottom: 0.5rem;
    animation: alertSlideIn var(--alert-animation-duration) ease-out;
}

.alerts-container .alert:last-child {
    margin-bottom: 0;
}

/* ================================================
   ALERTES INLINE DANS LES FORMULAIRES
   ================================================ */

.form-group .alert {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    font-size: 0.8125rem;
}

.form-group .alert .alert-icon {
    width: 1rem;
    height: 1rem;
}

/* ================================================
   ALERTES FLASH (MESSAGES SYSTÈME)
   ================================================ */

.flash-messages {
    margin-bottom: 1.5rem;
}

.flash-message {
    padding: var(--alert-padding);
    border-radius: var(--alert-border-radius);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: var(--alert-shadow);
    animation: alertFadeIn var(--alert-animation-duration) ease-out;
}

.flash-message:last-child {
    margin-bottom: 0;
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.flash-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.flash-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    margin-left: 0.75rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.flash-close:hover {
    opacity: 1;
}

/* ================================================
   ICÔNES PAR DÉFAUT (CARACTÈRES UNICODE)
   ================================================ */

.alert-success .alert-icon::before {
    content: "✓";
    font-weight: bold;
}

.alert-error .alert-icon::before,
.alert-danger .alert-icon::before {
    content: "✕";
    font-weight: bold;
}

.alert-warning .alert-icon::before {
    content: "⚠";
    font-weight: bold;
}

.alert-info .alert-icon::before {
    content: "ℹ";
    font-weight: bold;
}

.alert-primary .alert-icon::before {
    content: "●";
    font-weight: bold;
}

.alert-secondary .alert-icon::before {
    content: "○";
    font-weight: bold;
}

/* ================================================
   ANIMATIONS
   ================================================ */

@keyframes alertFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes alertFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.alert-fade-out {
    animation: alertFadeOut var(--alert-animation-duration) ease-in forwards;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

@media (max-width: 768px) {
    .alerts-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .alert {
        padding: 0.875rem;
        font-size: 0.875rem;
    }
    
    .alert-sm {
        padding: 0.625rem;
        font-size: 0.8125rem;
    }
    
    .alert-lg {
        padding: 1.25rem;
        font-size: 0.9375rem;
    }
}

@media (max-width: 480px) {
    .alert {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
    
    .alert-icon {
        width: 1rem;
        height: 1rem;
    }
    
    .alert-close {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 1.25rem;
    }
}

/* ================================================
   PRÉFÉRENCES D'ACCESSIBILITÉ
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    .alert {
        animation: none;
    }
    
    .alert-fade-out {
        animation: none;
        opacity: 0;
    }
    
    .alerts-container .alert {
        animation: none;
    }
}

@media (prefers-color-scheme: dark) {
    .alert {
        --alert-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

/* ================================================
   IMPRESSION
   ================================================ */

@media print {
    .alert {
        box-shadow: none;
        border: 1px solid #000;
        background: #fff !important;
        color: #000 !important;
    }
    
    .alert-close {
        display: none;
    }
    
    .alerts-container {
        position: static;
        max-width: none;
    }
}

/* ================================================
   UTILITAIRES
   ================================================ */

.alert-dismissible {
    padding-right: 3rem;
}

.alert-no-icon .alert-icon {
    display: none;
}

.alert-no-close .alert-close {
    display: none;
}

.alert-center {
    text-align: center;
}

.alert-right {
    text-align: right;
}

.alert-full-width {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.alert-sticky {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.alert-fixed {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
}