/* ═══════════════════════════════════════════════════════════════════
   Flash Messages - Refined Industrial Design
   ═══════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────
   Base Alert Styles
   ───────────────────────────────────────────────────────────────────── */
.alert {
    position: fixed;
    right: 1.5rem;
    top: 5rem;
    z-index: 1050;
    padding: 0.875rem 3rem 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    width: fit-content;
    max-width: min(420px, calc(100vw - 3rem));
    font-family: var(--font-body);
    font-size: 0.9375rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid transparent;

    /* Industrial accent: subtle left border */
    border-left-width: 3px;
}

/* ─────────────────────────────────────────────────────────────────────
   Alert Message Text
   ───────────────────────────────────────────────────────────────────── */
.alert-message {
    flex: 1;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.4;
}

/* ─────────────────────────────────────────────────────────────────────
   Close Button
   ───────────────────────────────────────────────────────────────────── */
.alert-dismissible .btn-close {
    position: absolute;
    top: 50%;
    right: 0.875rem;
    transform: translateY(-50%);
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    opacity: 0.5;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    filter: brightness(0) invert(1);
}

.alert-dismissible .btn-close:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* ─────────────────────────────────────────────────────────────────────
   Alert Types
   ───────────────────────────────────────────────────────────────────── */

/* Success - Muted forest green */
.alert-success {
    background-color: rgba(45, 125, 70, 0.95) !important;
    color: var(--steel-100) !important;
    border-color: var(--success);
    border-left-color: #4CAF50;
}

.alert-success .btn-close {
    filter: brightness(0) invert(1);
}

/* Warning - Brass accent */
.alert-warning {
    background-color: rgba(184, 134, 11, 0.95) !important;
    color: var(--steel-950) !important;
    border-color: var(--brass-500);
    border-left-color: var(--brass-300);
}

.alert-warning .btn-close {
    filter: brightness(0);
    opacity: 0.6;
}

.alert-warning .btn-close:hover {
    opacity: 0.9;
}

/* Info - Steel/neutral */
.alert-info {
    background-color: rgba(42, 49, 60, 0.98) !important;
    color: var(--steel-100) !important;
    border-color: var(--steel-600);
    border-left-color: var(--blueprint);
}

/* Danger - Deep crimson */
.alert-danger {
    background-color: rgba(184, 59, 59, 0.95) !important;
    color: var(--steel-100) !important;
    border-color: var(--danger);
    border-left-color: #EF5350;
}

/* ─────────────────────────────────────────────────────────────────────
   Animations
   ───────────────────────────────────────────────────────────────────── */
.flash-preenter {
    transform: translateX(120%);
    opacity: 0;
}

.flash-enter {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.flash-exit {
    animation: slideOut 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

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

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

/* ─────────────────────────────────────────────────────────────────────
   Light Theme Overrides
   ───────────────────────────────────────────────────────────────────── */

/* Alert backgrounds are hardcoded dark; restore light text regardless of theme variable overrides */
[data-theme="light"] .alert-success,
[data-theme="light"] .alert-info,
[data-theme="light"] .alert-danger {
    color: #e8ebef !important;
}

[data-theme="light"] .alert-warning {
    color: #0a0c0f !important;
}

/* ─────────────────────────────────────────────────────────────────────
   Responsive Adjustments
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .alert {
        right: 1rem;
        left: 1rem;
        max-width: none;
        width: auto;
    }
}
