/* ===================================
   Loading States & Overlays
   =================================== */

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4); /* Mesma transparência do modal de dashboard */
    backdrop-filter: blur(4px); /* Blur mais suave */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-loading);
    animation: fadeIn var(--transition-slow) ease-out;
}

.loading-container {
    text-align: center;
    animation: scaleIn var(--transition-slower) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========== Triple Ring Spinner ========== */
.loading-spinner {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-8);
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-radius: var(--radius-full);
    animation: spin 2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: var(--color-primary);
    animation-delay: -0.45s;
}

.spinner-ring:nth-child(2) {
    border-top-color: var(--color-primary-dark);
    animation-delay: -0.3s;
}

.spinner-ring:nth-child(3) {
    border-top-color: var(--color-primary-darker);
    animation-delay: -0.15s;
}

/* ========== Loading Text ========== */
.loading-title {
    color: var(--color-primary);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    margin: 0 0 var(--space-3) 0;
    text-shadow: var(--shadow-text);
    animation: pulse 2s ease-in-out infinite;
}

.loading-subtitle {
    color: var(--color-primary-light);
    font-size: var(--font-size-lg);
    margin: 0 0 var(--space-5) 0;
    opacity: 0.9;
}

/* ========== Loading Dots ========== */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-full);
    animation: bounce 1.4s ease-in-out infinite;
    box-shadow: var(--shadow-glow);
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* ========== Inline Loading ========== */
.inline-loading {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.inline-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(79, 195, 247, 0.3);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

/* ========== Page Loading ========== */
.page-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    flex-direction: column;
    gap: var(--space-4);
}

/* ========== Skeleton Loaders ========== */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: var(--space-3);
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-lg);
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

/* ========== Progress Bars ========== */
.progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-bar-animated {
    animation: progressBar 2s ease-in-out;
}

.progress-bar-indeterminate {
    width: 30%;
    animation: progressIndeterminate 1.5s ease-in-out infinite;
}

@keyframes progressIndeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* ========== Pulsing Elements ========== */
.pulse-dot {
    width: 12px;
    height: 12px;
    background: var(--color-success);
    border-radius: var(--radius-full);
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

.pulse-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: var(--color-success);
    border-radius: var(--radius-full);
    animation: ripple 2s ease-out infinite;
}

/* ========== Status Indicators ========== */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.status-dot.active {
    background: var(--color-success);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.inactive {
    background: var(--text-disabled);
}

.status-dot.error {
    background: var(--color-danger);
}

.status-dot.warning {
    background: var(--color-warning);
    animation: pulse 2s ease-in-out infinite;
}

/* ========== Loading Button States ========== */
.btn-loading-overlay {
    position: relative;
    pointer-events: none;
}

.btn-loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}
