/**
 * Loading States - Spinners, Skeleton Screens, Progress Bars
 * Twins Sports - E-commerce
 */

/* Spinner Base */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-large {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay .spinner {
    border-top-color: #dc2626;
}

/* Loading Button */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

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

/* Skeleton Screen */
.skeleton {
    background: linear-gradient(
        90deg,
        #1a1a1a 0%,
        #262626 50%,
        #1a1a1a 100%
    );
    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: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

.skeleton-card {
    background: #1a1a1a;
    border-radius: 15px;
    padding: 20px;
}

.skeleton-card .skeleton-image {
    margin-bottom: 15px;
}

.skeleton-card .skeleton-title {
    margin-bottom: 10px;
}

.skeleton-card .skeleton-text {
    margin-bottom: 8px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Loading States para Cards */
.product-card.loading {
    pointer-events: none;
}

.product-card.loading .product-image {
    background: #1a1a1a;
}

.product-card.loading .product-image img {
    opacity: 0;
}

.product-card.loading .product-name,
.product-card.loading .product-price {
    background: #1a1a1a;
    color: transparent;
    border-radius: 4px;
}

/* Loading State para Formulários */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    z-index: 1;
}

/* Loading State para Tabelas */
.table-loading {
    position: relative;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

/* Loading State para Imagens */
.image-loading {
    position: relative;
    background: #1a1a1a;
    overflow: hidden;
}

.image-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: image-shimmer 1.5s infinite;
}

@keyframes image-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.image-loading img {
    opacity: 0;
    transition: opacity 0.3s;
}

.image-loading img.loaded {
    opacity: 1;
}

/* Feedback Visual - Sucesso/Erro */
.feedback-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.feedback-message.success {
    background: #10b981;
}

.feedback-message.error {
    background: #dc2626;
}

.feedback-message.info {
    background: #3b82f6;
}

.feedback-message.warning {
    background: #f59e0b;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.feedback-message.hide {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Loading State para Botões de Ação */
.action-loading {
    position: relative;
    min-width: 120px;
}

.action-loading .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.action-loading span {
    opacity: 0;
}

/* Responsivo */
@media (max-width: 768px) {
    .loading-overlay {
        padding: 20px;
    }
    
    .feedback-message {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
    }
}

