/**
 * Composants UI de l'application UMOA
 * Design System unifié Web ↔ Mobile
 * 
 * @package UMOA
 * @version 2.0
 */

/* ============================================================================
   MESSAGES FLASH (Notifications)
   ============================================================================ */

.flash-messages {
    position: fixed;
    top: 80px;
    right: var(--spacing-5);
    z-index: 2000;
    max-width: 400px;
}

.flash-message {
    padding: var(--spacing-4) var(--spacing-6);
    margin-bottom: var(--spacing-3);
    border-radius: var(--radius-md);
    /* Ombre douce premium */
    box-shadow: 
        0 4px 10px 0 rgba(0, 0, 0, 0.10), 
        0 8px 20px 0 rgba(0, 0, 0, 0.18);
    animation: slideInRight 0.3s var(--curve-ease-out);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.flash-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.flash-message.success {
    background-color: rgba(16, 185, 129, 0.95);
    color: var(--white);
}

.flash-message.success::before {
    background-color: rgba(255, 255, 255, 0.5);
}

.flash-message.error {
    background-color: rgba(239, 68, 68, 0.95);
    color: var(--white);
}

.flash-message.error::before {
    background-color: rgba(255, 255, 255, 0.5);
}

.flash-message.warning {
    background-color: rgba(245, 158, 11, 0.95);
    color: var(--white);
}

.flash-message.warning::before {
    background-color: rgba(255, 255, 255, 0.5);
}

.flash-message.info {
    background: #7B2CBF; /* Violet UMOA - couleur unie */
    color: var(--white);
}

.flash-message.info::before {
    background-color: rgba(255, 255, 255, 0.5);
}

@keyframes slideInRight {
    from {
        transform: translateX(calc(100% + 20px));
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(calc(100% + 20px));
        opacity: 0;
    }
}

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner {
    border: 3px solid var(--gray-200);
    border-top: 3px solid transparent;
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: var(--spacing-8) auto;
    position: relative;
}

.spinner::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: var(--radius-full);
    border: 3px solid transparent;
    border-top-color: var(--blue-light);
    animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Spinner avec dégradé */
.spinner-gradient {
    background: #7B2CBF; /* Violet UMOA - couleur unie */
    -webkit-mask: radial-gradient(
        circle at 50% 0%, 
        transparent 0%, 
        transparent 46%, 
        black 46%
    );
    mask: radial-gradient(
        circle at 50% 0%, 
        transparent 0%, 
        transparent 46%, 
        black 46%
    );
    border: none;
}

.spinner-gradient::before {
    display: none;
}

/* Tailles de spinner */
.spinner-sm {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    padding: var(--spacing-1) var(--spacing-3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    transition: transform var(--duration-fast) var(--curve-ease-out);
}

.badge:hover {
    transform: scale(1.05);
}

.badge-primary {
    background: #7B2CBF; /* Violet UMOA - couleur unie */
    color: var(--white);
    box-shadow: 0 2px 4px 0 rgba(107, 182, 255, 0.3);
}

.badge-success {
    background-color: var(--success-color);
    color: var(--white);
    box-shadow: 0 2px 4px 0 rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background-color: var(--danger-color);
    color: var(--white);
    box-shadow: 0 2px 4px 0 rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background-color: var(--warning-color);
    color: var(--white);
    box-shadow: 0 2px 4px 0 rgba(245, 158, 11, 0.3);
}

.badge-info {
    background-color: var(--info-color);
    color: var(--white);
    box-shadow: 0 2px 4px 0 rgba(59, 130, 246, 0.3);
}

/* Badge outline */
.badge-outline {
    background-color: transparent;
    border: 1.5px solid currentColor;
}

.badge-outline.badge-primary {
    color: var(--blue-deep);
    box-shadow: none;
}

.badge-outline.badge-success {
    color: var(--success-color);
    box-shadow: none;
}

.badge-outline.badge-danger {
    color: var(--danger-color);
    box-shadow: none;
}

/* Badge avec compteur */
.badge-dot {
    padding: 0;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.badge-pill {
    min-width: 20px;
    height: 20px;
    padding: 0 var(--spacing-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
   ALERTES
   ============================================================================ */

.alert {
    padding: var(--spacing-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-4);
    position: relative;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    box-shadow: var(--shadow-soft-sm);
    animation: slideInUp 0.3s var(--curve-ease-out);
}

.alert-success {
    background-color: rgba(209, 250, 229, 0.9);
    color: #065f46;
    border-left-color: var(--success-color);
}

.alert-error {
    background-color: rgba(254, 226, 226, 0.9);
    color: #991b1b;
    border-left-color: var(--danger-color);
}

.alert-warning {
    background-color: rgba(254, 243, 199, 0.9);
    color: #92400e;
    border-left-color: var(--warning-color);
}

.alert-info {
    background-color: rgba(219, 234, 254, 0.9);
    color: #1e40af;
    border-left-color: var(--info-color);
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: var(--spacing-1);
}

.alert-message {
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-1);
    color: currentColor;
    opacity: 0.6;
    transition: opacity var(--duration-fast);
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
}

.alert-close:hover {
    opacity: 1;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

