/* 
 * Loading States - Sistema BPO
 * Estilos para estados de carregamento, skeletons e spinners
 */

/* ========================================
   SPINNER CIRCULAR
   ======================================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(77, 166, 255, 0.3);
    border-radius: 50%;
    border-top-color: #4da6ff;
    animation: spin 0.8s linear infinite;
}

.spinner.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.spinner.spinner-xl {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.spinner.spinner-white {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
}

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

/* ========================================
   LOADING OVERLAY
   ======================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 27, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-overlay .loading-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

/* ========================================
   BOTÃO COM LOADING
   ======================================== */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   SKELETON SCREENS
   ======================================== */
.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-shimmer 1.5s infinite;
    border-radius: 4px;
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Skeleton Text */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.skeleton-text-sm {
    height: 12px;
}

.skeleton-text.skeleton-text-lg {
    height: 24px;
}

.skeleton-text:last-child {
    width: 70%;
}

/* Skeleton Circle (Avatar) */
.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-circle.skeleton-circle-lg {
    width: 60px;
    height: 60px;
}

/* Skeleton Card */
.skeleton-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.skeleton-card .skeleton-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.skeleton-card .skeleton-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Skeleton Table */
.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.skeleton-table-cell {
    flex: 1;
}

.skeleton-table-cell.skeleton-table-cell-sm {
    flex: 0.5;
}

.skeleton-table-cell.skeleton-table-cell-lg {
    flex: 2;
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4da6ff, #66b3ff);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.progress-bar-animated {
    animation: progress-stripes 1s linear infinite;
    background-image: linear-gradient(45deg,
            rgba(255, 255, 255, 0.15) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0.15) 75%,
            transparent 75%,
            transparent);
    background-size: 40px 40px;
}

@keyframes progress-stripes {
    from {
        background-position: 40px 0;
    }

    to {
        background-position: 0 0;
    }
}

/* ========================================
   LOADING DOTS
   ======================================== */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #4da6ff;
    border-radius: 50%;
    animation: loading-dots 1.4s infinite ease-in-out both;
}

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

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

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

@keyframes loading-dots {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   PULSE ANIMATION
   ======================================== */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   FADE IN ANIMATION
   ======================================== */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered fade in for lists */
.fade-in-stagger>* {
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

.fade-in-stagger>*:nth-child(1) {
    animation-delay: 0.05s;
}

.fade-in-stagger>*:nth-child(2) {
    animation-delay: 0.1s;
}

.fade-in-stagger>*:nth-child(3) {
    animation-delay: 0.15s;
}

.fade-in-stagger>*:nth-child(4) {
    animation-delay: 0.2s;
}

.fade-in-stagger>*:nth-child(5) {
    animation-delay: 0.25s;
}

.fade-in-stagger>*:nth-child(6) {
    animation-delay: 0.3s;
}

.fade-in-stagger>*:nth-child(7) {
    animation-delay: 0.35s;
}

.fade-in-stagger>*:nth-child(8) {
    animation-delay: 0.4s;
}

.fade-in-stagger>*:nth-child(9) {
    animation-delay: 0.45s;
}

.fade-in-stagger>*:nth-child(10) {
    animation-delay: 0.5s;
}

/* ========================================
   SCALE ANIMATION
   ======================================== */
.scale-in {
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   SLIDE ANIMATIONS
   ======================================== */
.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.empty-state-description {
    color: rgba(255, 255, 255, 0.6);
    max-width: 300px;
}

.empty-state-action {
    margin-top: 24px;
}