/**
 * Skeleton Loaders
 * Placeholders animados para mejorar la percepción de carga
 */

/* Animación de pulse */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

/* Clase base skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Skeleton para producto card */
.skeleton-product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.skeleton-product-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 50%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-product-content {
    padding: 20px;
}

.skeleton-product-title {
    height: 20px;
    width: 70%;
    margin-bottom: 12px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 50%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-product-description {
    height: 14px;
    width: 90%;
    margin-bottom: 8px;
    background: linear-gradient(
        90deg,
        #e8e8e8 0%,
        #f4f4f4 50%,
        #e8e8e8 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-product-description:last-child {
    width: 60%;
}

.skeleton-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.skeleton-product-price {
    height: 24px;
    width: 80px;
    background: linear-gradient(
        90deg,
        #d0d0d0 0%,
        #e0e0e0 50%,
        #d0d0d0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-product-button {
    height: 36px;
    width: 36px;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        #d8d8d8 0%,
        #e8e8e8 50%,
        #d8d8d8 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Skeleton para lista de items en checkout */
.skeleton-cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 10px;
}

.skeleton-cart-thumbnail {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 50%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-cart-info {
    flex: 1;
}

.skeleton-cart-title {
    height: 18px;
    width: 60%;
    margin-bottom: 8px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 50%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-cart-detail {
    height: 14px;
    width: 80%;
    margin-bottom: 6px;
    background: linear-gradient(
        90deg,
        #e8e8e8 0%,
        #f4f4f4 50%,
        #e8e8e8 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-cart-price {
    height: 16px;
    width: 70px;
    background: linear-gradient(
        90deg,
        #d0d0d0 0%,
        #e0e0e0 50%,
        #d0d0d0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Skeleton para tabla en admin */
.skeleton-table-row {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.skeleton-table-cell {
    height: 16px;
    background: linear-gradient(
        90deg,
        #e8e8e8 0%,
        #f4f4f4 50%,
        #e8e8e8 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-table-cell:nth-child(1) { flex: 0 0 60px; }
.skeleton-table-cell:nth-child(2) { flex: 1; }
.skeleton-table-cell:nth-child(3) { flex: 0 0 100px; }
.skeleton-table-cell:nth-child(4) { flex: 0 0 80px; }
.skeleton-table-cell:nth-child(5) { flex: 0 0 100px; }

/* Skeleton para texto */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    background: linear-gradient(
        90deg,
        #e8e8e8 0%,
        #f4f4f4 50%,
        #e8e8e8 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

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

.skeleton-text-long {
    width: 95%;
}

/* Skeleton para avatar/imagen circular */
.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 50%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Grid de productos skeleton */
.productos-grid.loading {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .skeleton-product-image {
        height: 150px;
    }

    .productos-grid.loading {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .skeleton-product-content {
        padding: 15px;
    }

    .skeleton-cart-item {
        padding: 10px;
    }

    .skeleton-cart-thumbnail {
        width: 50px;
        height: 50px;
    }
}

/* Utilidad para ocultar elementos durante carga */
.hidden-loading {
    display: none;
}
