/* =========================================================================
   ALERTS - Notification & Message Styles
   ========================================================================= */

/**
 * Alert components for user feedback, notifications, and system messages.
 * Built on Bootstrap alerts with enhanced styling and animations.
 */

/* ---------------------------------------------------------------------
   Base Alert Style
   --------------------------------------------------------------------- */

.alert {
    border-radius: 0.75rem;
    border-width: 1px;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: alertFadeIn 0.25s ease-out;
}

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

.alert a {
    font-weight: 600;
    text-decoration: underline;
}

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

/* Alert with icon */
.alert-icon {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-icon i,
.alert-icon svg {
    flex-shrink: 0;
    font-size: 1.1rem;
    margin-top: 0.125rem;
}

/* ---------------------------------------------------------------------
   Alert Variants (Bootstrap-compatible)
   --------------------------------------------------------------------- */

/* Success */
.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.alert-success a {
    color: #0a3622;
}

/* Danger / Error */
.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.alert-danger a {
    color: #5c151a;
}

/* Warning */
.alert-warning {
    background-color: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.alert-warning a {
    color: #3d2e02;
}

/* Info */
.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

.alert-info a {
    color: #032830;
}

/* Primary */
.alert-primary {
    background-color: #cfe2ff;
    border-color: #b6d4fe;
    color: #084298;
}

.alert-primary a {
    color: #052c65;
}

/* Secondary */
.alert-secondary {
    background-color: #e2e3e5;
    border-color: #d3d6d8;
    color: #41464b;
}

.alert-secondary a {
    color: #2b2e31;
}

/* ---------------------------------------------------------------------
   Dismissible Alerts
   --------------------------------------------------------------------- */

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

.alert-dismissible .btn-close {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    padding: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.alert-dismissible .btn-close:hover {
    opacity: 0.85;
}

/* ---------------------------------------------------------------------
   Alert Animations
   --------------------------------------------------------------------- */

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

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

.alert.fade-out {
    animation: alertFadeOut 0.2s ease-out forwards;
}

/* Slide-in variation */
@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert.slide-in {
    animation: alertSlideIn 0.3s ease-out;
}

/* ---------------------------------------------------------------------
   Compact Alerts (for inline use)
   --------------------------------------------------------------------- */

.alert-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
}

.alert-sm .btn-close {
    padding: 0.375rem;
}

/* ---------------------------------------------------------------------
   Toast-style Alerts (fixed position)
   --------------------------------------------------------------------- */

.alert-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.alert-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ---------------------------------------------------------------------
   Dark Theme Adjustments
   --------------------------------------------------------------------- */

body.theme-dark .alert-success {
    background-color: rgba(25, 135, 84, 0.2);
    border-color: rgba(25, 135, 84, 0.35);
    color: #75d9a3;
}

body.theme-dark .alert-success a {
    color: #9fe7be;
}

body.theme-dark .alert-danger {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.35);
    color: #f5a3ab;
}

body.theme-dark .alert-danger a {
    color: #f9c4c9;
}

body.theme-dark .alert-warning {
    background-color: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.35);
    color: #ffe066;
}

body.theme-dark .alert-warning a {
    color: #ffeb99;
}

body.theme-dark .alert-info {
    background-color: rgba(13, 202, 240, 0.2);
    border-color: rgba(13, 202, 240, 0.35);
    color: #6edff6;
}

body.theme-dark .alert-info a {
    color: #9fe9f9;
}

body.theme-dark .alert-primary {
    background-color: rgba(13, 110, 253, 0.2);
    border-color: rgba(13, 110, 253, 0.35);
    color: #6ea8fe;
}

body.theme-dark .alert-primary a {
    color: #9ec5fe;
}

body.theme-dark .alert-secondary {
    background-color: rgba(108, 117, 125, 0.2);
    border-color: rgba(108, 117, 125, 0.35);
    color: #bdc3c8;
}

body.theme-dark .alert-secondary a {
    color: #d8dce0;
}

/* Dark theme dismiss button */
body.theme-dark .alert .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ---------------------------------------------------------------------
   Responsive Adjustments
   --------------------------------------------------------------------- */

@media (max-width: 576px) {
    .alert-toast {
        left: 1rem;
        right: 1rem;
        min-width: auto;
        max-width: none;
    }

    .alert-toast-container {
        left: 1rem;
        right: 1rem;
    }
}
