/* =========================================================
   AIDF Toast Notification Styles
   No framework dependencies. Layered over Bootstrap safely.
   =========================================================

   Also includes the shared .aidf-input-error class used by
   aidf-forms.js for AJAX validation highlighting, and the
   .aidf-btn-spinner used during form submission.
   ========================================================= */

#aidf-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10500;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    pointer-events: none;
}

.aidf-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.08);
    border-left: 4px solid transparent;
    opacity: 0;
    transform: translateX(110%);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(.22,.68,0,1.2);
    pointer-events: all;
    position: relative;
    min-width: 0;
    word-break: break-word;
}

.aidf-toast--visible {
    opacity: 1;
    transform: translateX(0);
}

.aidf-toast--leaving {
    opacity: 0;
    transform: translateX(110%);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

/* Type variants */
.aidf-toast--success {
    border-color: #16a34a;
    background: #f0fdf4;
}
.aidf-toast--success .aidf-toast__icon { color: #16a34a; }

.aidf-toast--error {
    border-color: #dc2626;
    background: #fef2f2;
}
.aidf-toast--error .aidf-toast__icon { color: #dc2626; }

.aidf-toast--warning {
    border-color: #d97706;
    background: #fffbeb;
}
.aidf-toast--warning .aidf-toast__icon { color: #d97706; }

.aidf-toast--info {
    border-color: #1d4ed8;
    background: #eff6ff;
}
.aidf-toast--info .aidf-toast__icon { color: #1d4ed8; }

/* Icon */
.aidf-toast__icon {
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 1;
}

/* Body */
.aidf-toast__body {
    flex: 1;
    min-width: 0;
}

.aidf-toast__title {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #111827;
    margin-bottom: 0.125rem;
    line-height: 1.3;
}

.aidf-toast__msg {
    font-size: 0.8125rem;
    color: #374151;
    line-height: 1.45;
}

/* Close button */
.aidf-toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 2px;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 3px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    margin-top: 1px;
}
.aidf-toast__close:hover {
    color: #374151;
    background: rgba(0,0,0,.06);
}

/* Mobile: bottom of screen */
@media (max-width: 575.98px) {
    #aidf-toast-container {
        top: auto;
        bottom: 1rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-width: 100%;
    }

    .aidf-toast {
        transform: translateY(120%);
    }

    .aidf-toast--visible {
        transform: translateY(0);
    }

    .aidf-toast--leaving {
        transform: translateY(120%);
    }
}

/* =========================================================
   AJAX Form States (used by aidf-forms.js)
   ========================================================= */

/* Input highlighted as invalid by AJAX validation */
.aidf-input-error,
.aidf-input-error.form-control,
.aidf-input-error.form-select {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important;
}

/* Submit button spinner */
.aidf-btn-spinner {
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: aidf-spin 0.6s linear infinite;
    vertical-align: -0.1em;
}

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

/* Subtle opacity on loading form */
.aidf-form--loading {
    opacity: 0.75;
    pointer-events: none;
}
