/**
 * Toast Notifications & Loading States
 * Provides visual feedback for errors, success, and loading
 */

/* ==================== TOAST NOTIFICATIONS ==================== */

.error-toast,
.success-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    max-width: 400px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.error-toast.show,
.success-toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.error-toast {
    background: #dc3545;
    color: white;
}

.success-toast {
    background: #19c37d;
    color: white;
}

/* ==================== LOADING STATES ==================== */

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: 'Generating...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
    animation: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button loading state */
button.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

button.loading::before {
    content: '...';
    display: inline-block;
    margin-right: 4px;
    animation: none;
}

/* ==================== PAGE LOADER ==================== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.page-loader.show {
    opacity: 1;
    visibility: visible;
}

.loader-spinner {
    color: #666;
    font-size: 16px;
    animation: none;
}

/* ==================== SKELETON LOADING ==================== */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin: 8px 0;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin: 12px 0;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* ==================== DISABLED STATE ==================== */

[aria-busy="true"] {
    cursor: wait;
    opacity: 0.6;
}

.disabled,
[disabled] {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* ==================== SCREEN READER ONLY ==================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
