/* =========================================================
   AluminiumGlass
   alerts.css
   Global Alert / Notification Components
   ========================================================= */

:root {
    --alert-radius: 10px;
    --alert-padding: 14px 16px;
    --alert-gap: 10px;
    --alert-border-width: 1px;
    --alert-font-size: 14px;
    --alert-line-height: 1.5;
}

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

.alert {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--alert-gap);

    width: 100%;
    padding: var(--alert-padding);

    border: var(--alert-border-width) solid transparent;
    border-radius: var(--alert-radius);

    font-size: var(--alert-font-size);
    line-height: var(--alert-line-height);

    box-sizing: border-box;
}

/* ---------------------------------------------------------
   Alert Content
   --------------------------------------------------------- */

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-title {
    display: block;
    margin: 0 0 4px;

    font-size: 15px;
    font-weight: 700;
}

.alert-message {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
}

/* ---------------------------------------------------------
   Alert Icon
   --------------------------------------------------------- */

.alert-icon {
    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 22px;
    height: 22px;

    font-size: 16px;
    line-height: 1;
}

/* ---------------------------------------------------------
   Alert Close Button
   --------------------------------------------------------- */

.alert-close {
    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    margin: -5px -5px 0 0;
    padding: 0;

    border: 0;
    border-radius: 6px;

    background: transparent;
    color: inherit;

    font-size: 18px;
    line-height: 1;

    cursor: pointer;
    opacity: 0.75;

    transition:
        opacity 0.2s ease,
        background-color 0.2s ease;
}

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

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

/* ---------------------------------------------------------
   Success
   --------------------------------------------------------- */

.alert-success {
    background: #ecfdf3;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-success .alert-title {
    color: #047857;
}

/* ---------------------------------------------------------
   Error / Danger
   --------------------------------------------------------- */

.alert-danger,
.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-danger .alert-title,
.alert-error .alert-title {
    color: #b91c1c;
}

/* ---------------------------------------------------------
   Warning
   --------------------------------------------------------- */

.alert-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert-warning .alert-title {
    color: #b45309;
}

/* ---------------------------------------------------------
   Information
   --------------------------------------------------------- */

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-info .alert-title {
    color: #1d4ed8;
}

/* ---------------------------------------------------------
   Neutral
   --------------------------------------------------------- */

.alert-neutral {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
}

.alert-neutral .alert-title {
    color: #1e293b;
}

/* ---------------------------------------------------------
   Small Alert
   --------------------------------------------------------- */

.alert-sm {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.alert-sm .alert-title {
    font-size: 14px;
}

.alert-sm .alert-message {
    font-size: 13px;
}

.alert-sm .alert-icon {
    width: 20px;
    height: 20px;
    font-size: 14px;
}

/* ---------------------------------------------------------
   Large Alert
   --------------------------------------------------------- */

.alert-lg {
    padding: 18px 20px;
    border-radius: 12px;
    font-size: 15px;
}

.alert-lg .alert-title {
    font-size: 17px;
}

.alert-lg .alert-message {
    font-size: 15px;
}

/* ---------------------------------------------------------
   Dismissible Alert
   --------------------------------------------------------- */

.alert-dismissible {
    padding-right: 48px;
}

.alert-dismissible .alert-close {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* ---------------------------------------------------------
   Alert With Action
   --------------------------------------------------------- */

.alert-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 10px;
}

.alert-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 34px;
    padding: 7px 12px;

    border: 1px solid currentColor;
    border-radius: 6px;

    background: transparent;
    color: inherit;

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;
    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.alert-action:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* ---------------------------------------------------------
   Alert List
   --------------------------------------------------------- */

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 12px;

    width: 100%;
}

/* ---------------------------------------------------------
   Inline Alert
   --------------------------------------------------------- */

.alert-inline {
    display: inline-flex;
    width: auto;
    max-width: 100%;
}

/* ---------------------------------------------------------
   Form Alert
   --------------------------------------------------------- */

.form-alert {
    margin-top: 8px;
    margin-bottom: 12px;
}

/* ---------------------------------------------------------
   Form Field Error
   --------------------------------------------------------- */

.field-error {
    display: block;

    margin-top: 5px;

    color: #b91c1c;
    font-size: 12px;
    line-height: 1.4;
}

.input-error {
    border-color: #ef4444 !important;
}

.input-error:focus {
    outline: 2px solid rgba(239, 68, 68, 0.2);
    outline-offset: 1px;
}

/* ---------------------------------------------------------
   Toast Container
   --------------------------------------------------------- */

.toast-container {
    position: fixed;
    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 10px;

    width: min(400px, calc(100vw - 32px));

    pointer-events: none;
}

.toast-container.top-right {
    top: 20px;
    right: 20px;
}

.toast-container.top-left {
    top: 20px;
    left: 20px;
}

.toast-container.bottom-right {
    right: 20px;
    bottom: 20px;
}

.toast-container.bottom-left {
    bottom: 20px;
    left: 20px;
}

.toast-container.top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.toast-container.bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

/* ---------------------------------------------------------
   Toast
   --------------------------------------------------------- */

.toast {
    position: relative;

    display: flex;
    align-items: flex-start;
    gap: 10px;

    width: 100%;
    padding: 13px 14px;

    border: 1px solid #e2e8f0;
    border-radius: 10px;

    background: #ffffff;

    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.12),
        0 2px 8px rgba(15, 23, 42, 0.06);

    pointer-events: auto;

    box-sizing: border-box;
}

.toast .alert-content {
    flex: 1;
}

.toast .alert-close {
    margin-top: -2px;
}

/* ---------------------------------------------------------
   Toast Progress
   --------------------------------------------------------- */

.toast-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;

    height: 3px;

    overflow: hidden;
    border-radius: 0 0 10px 10px;
}

.toast-progress::after {
    content: "";

    display: block;

    width: 100%;
    height: 100%;

    background: currentColor;

    transform-origin: left center;
}

/* ---------------------------------------------------------
   Status Dot
   --------------------------------------------------------- */

.alert-status-dot {
    flex: 0 0 auto;

    width: 8px;
    height: 8px;

    margin-top: 6px;

    border-radius: 50%;
    background: currentColor;
}

/* ---------------------------------------------------------
   Loading Alert
   --------------------------------------------------------- */

.alert-loading {
    align-items: center;
}

.alert-loading .alert-spinner {
    width: 18px;
    height: 18px;

    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;

    animation: alert-spin 0.8s linear infinite;
}

@keyframes alert-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------
   Mobile
   --------------------------------------------------------- */

@media (max-width: 600px) {
    .alert {
        padding: 12px 13px;
    }

    .alert-title {
        font-size: 14px;
    }

    .alert-message {
        font-size: 13px;
    }

    .toast-container {
        width: calc(100vw - 24px);
    }

    .toast-container.top-right,
    .toast-container.top-left,
    .toast-container.bottom-right,
    .toast-container.bottom-left {
        right: 12px;
        left: 12px;
    }

    .toast-container.top-center,
    .toast-container.bottom-center {
        left: 12px;
        right: 12px;
        width: calc(100vw - 24px);
        transform: none;
    }
}

/* ---------------------------------------------------------
   Reduced Motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .alert-close,
    .alert-action {
        transition: none;
    }

    .alert-loading .alert-spinner {
        animation: none;
    }
}

/* ---------------------------------------------------------
   Print
   --------------------------------------------------------- */

@media print {
    .alert {
        box-shadow: none;
        break-inside: avoid;
    }

    .alert-close,
    .toast-container {
        display: none !important;
    }
}