/* ===== LOADING STATES & ERROR HANDLING ===== */
/* Production-Grade UX */

/* ===== SKELETON LOADERS ===== */
.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 2rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 200px;
    margin-bottom: 1rem;
}

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(56, 239, 125, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner-small {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.spinner-large {
    width: 64px;
    height: 64px;
    border-width: 5px;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.loading-overlay .spinner {
    margin-bottom: 1.5rem;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 1rem;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-indeterminate {
    position: absolute;
    height: 100%;
    width: 30%;
    background: var(--primary-gradient);
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        left: -30%;
    }

    100% {
        left: 100%;
    }
}

/* ===== ERROR STATES ===== */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    color: #fca5a5;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin: 1rem 0;
}

.error-message i {
    color: #ef4444;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.error-message-content h4 {
    color: #fca5a5;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.error-message-content p {
    color: #fca5a5;
    font-size: 0.95rem;
    line-height: 1.5;
}

.error-retry-btn {
    margin-top: 1rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.error-retry-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}

/* ===== SUCCESS STATES ===== */
.success-message {
    background: rgba(56, 239, 125, 0.1);
    border: 1px solid rgba(56, 239, 125, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    color: #86efac;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin: 1rem 0;
}

.success-message i {
    color: var(--primary-color);
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* ===== WARNING STATES ===== */
.warning-message {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    color: #fcd34d;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin: 1rem 0;
}

.warning-message i {
    color: #fbbf24;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    animation: toast-slide-in 0.3s ease;
    backdrop-filter: blur(10px);
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.toast-success {
    border-left: 4px solid var(--primary-color);
}

.toast.toast-error {
    border-left: 4px solid #ef4444;
}

.toast.toast-warning {
    border-left: 4px solid #fbbf24;
}

.toast.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1.5rem;
}

.toast-success .toast-icon {
    color: var(--primary-color);
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning .toast-icon {
    color: #fbbf24;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

.toast-content h4 {
    color: var(--text-main);
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.toast-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: var(--text-main);
}

/* ===== FORM VALIDATION STATES ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(56, 239, 125, 0.1);
}

.form-control.is-invalid {
    border-color: #ef4444;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.is-valid {
    border-color: var(--primary-color);
}

.invalid-feedback {
    color: #fca5a5;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
}

.form-control.is-invalid~.invalid-feedback {
    display: block;
}

.valid-feedback {
    color: #86efac;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
}

.form-control.is-valid~.valid-feedback {
    display: block;
}

/* ===== BUTTON LOADING STATES ===== */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .toast {
        padding: 1rem;
    }

    .error-message,
    .success-message,
    .warning-message {
        padding: 1.25rem;
    }

    .empty-state {
        padding: 3rem 1.5rem;
    }

    .empty-state-icon {
        font-size: 3rem;
    }
}