/* ========================================
   LOADING SPINNERS - CEDIST
   Sistema de spinners personalizados
   ======================================== */

/* Spinner principal para catálogo */
.cedist-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.cedist-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: cedist-spin 1s linear infinite;
    margin-bottom: 15px;
}

.cedist-spinner-small {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: cedist-spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* Spinner para carrito */
.carrito-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
}

.carrito-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e3e3e3;
    border-top: 3px solid #28a745;
    border-radius: 50%;
    animation: cedist-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

/* Spinner para pedidos */
.pedidos-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pedidos-spinner {
    width: 45px;
    height: 45px;
    border: 4px solid #dee2e6;
    border-top: 4px solid #dc3545;
    border-radius: 50%;
    animation: cedist-spin 1.2s linear infinite;
    margin-bottom: 15px;
}

/* Spinner inline para operaciones rápidas */
.inline-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.inline-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: cedist-spin 0.6s linear infinite;
}

/* Overlay loader para pantalla completa */
.overlay-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeInBackdrop 0.3s ease-out;
}

/* Variante con backdrop más sutil */
.overlay-loader.light {
    background: rgba(255, 255, 255, 0.85);
}

/* Variante con backdrop más intenso */
.overlay-loader.dark {
    background: rgba(0, 0, 0, 0.9);
}

@keyframes fadeInBackdrop {
    from {
        opacity: 0;
        -webkit-backdrop-filter: blur(0px);
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
    }
}

/* Loader con backdrop para secciones */
.section-backdrop-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.overlay-spinner {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top: 6px solid #ffffff;
    border-right: 6px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: cedist-spin 1.2s linear infinite;
    margin-bottom: 25px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

/* Spinner para overlay claro */
.overlay-loader.light .overlay-spinner {
    border: 6px solid rgba(0, 0, 0, 0.1);
    border-top: 6px solid #007bff;
    border-right: 6px solid rgba(0, 123, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.3);
    filter: drop-shadow(0 0 10px rgba(0, 123, 255, 0.4));
}

.overlay-text {
    color: white;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 10px;
    opacity: 0.95;
}

.overlay-loader.light .overlay-text {
    color: #333;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Contenedor del spinner con animación de entrada */
.overlay-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.4s ease-out;
    transform-origin: center;
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Spinner con pulso para búsquedas */
.search-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 15px;
}

.search-spinner {
    width: 35px;
    height: 35px;
    background: #007bff;
    border-radius: 50%;
    animation: cedist-pulse 1.5s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes cedist-pulse {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Skeleton loader para productos */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: cedist-skeleton 1.5s infinite;
}

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

.skeleton-product {
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
}

.skeleton-line {
    height: 20px;
    margin: 8px 0;
    border-radius: 4px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-line.long {
    width: 100%;
}

/* Texto de carga */
.loading-text {
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
}

.loading-text.primary {
    color: #007bff;
}

.loading-text.success {
    color: #28a745;
}

.loading-text.danger {
    color: #dc3545;
}

/* Animaciones de entrada y salida */
.fade-in-loader {
    animation: fadeInLoader 0.3s ease-in;
}

.fade-out-loader {
    animation: fadeOutLoader 0.3s ease-out;
}

@keyframes fadeInLoader {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutLoader {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .cedist-loader {
        padding: 30px 15px;
    }
    
    .pedidos-loader {
        padding: 40px 15px;
    }
    
    .overlay-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .overlay-text {
        font-size: 14px;
    }
}
