/**
 * Melhorias de UX - Estilos CSS
 * Loading states, empty states, toasts e transições
 */

/* ===== LOADING STATES ===== */
.search-loading {
    position: relative;
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin: 1rem 0;
    animation: fadeIn 0.3s ease;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading-spinner i {
    font-size: 1.2rem;
    color: var(--accent-primary);
}

.loading-spinner .fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* ===== EMPTY STATES ===== */
.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 15px;
    margin: 2rem 0;
    border: 2px dashed var(--border-color);
    animation: fadeIn 0.5s ease;
}

.empty-state-content i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
}

.empty-state-content h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.empty-state-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.btn-clear-filters {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-clear-filters:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow);
}

.btn-clear-filters:active {
    transform: translateY(0);
}

/* ===== TOASTS ===== */
.error-toast,
.success-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    min-width: 300px;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

.error-toast {
    background: var(--danger);
    color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(248, 113, 113, 0.3);
}

.success-toast {
    background: var(--success);
    color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(74, 222, 128, 0.3);
}

.error-content,
.success-content {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.error-content i,
.success-content i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.error-content span,
.success-content span {
    flex: 1;
    font-weight: 500;
}

.error-content button,
.success-content button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.error-content button:hover,
.success-content button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* ===== MELHORIAS DE TRANSITION ===== */
.model-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.model-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.service-tag {
    transition: all 0.2s ease !important;
}

.service-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow);
}

.filter-group {
    transition: all 0.2s ease !important;
}

/* ===== LOADING STATES PARA FORMULÁRIOS ===== */
form.loading button[type="submit"] {
    position: relative;
    pointer-events: none;
}

form.loading button[type="submit"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .error-toast,
    .success-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .empty-state {
        padding: 2rem 1rem;
        margin: 1rem 0;
    }
    
    .empty-state-content h3 {
        font-size: 1.3rem;
    }
    
    .btn-clear-filters {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* ===== TEMA CLARO ===== */
[data-theme="light"] .search-loading {
    background: var(--bg-secondary) !important;
}

[data-theme="light"] .empty-state {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

[data-theme="light"] .empty-state-content h3 {
    color: var(--text-primary) !important;
}

[data-theme="light"] .empty-state-content p {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .empty-state-content i {
    color: var(--text-muted) !important;
}

/* ===== ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {
    .model-card,
    .service-tag,
    .filter-group,
    .loading-spinner .fa-spinner {
        animation: none !important;
        transition: none !important;
    }
    
    .model-card:hover {
        transform: none !important;
    }
}

/* ===== FOCUS STATES ===== */
.btn-clear-filters:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.error-content button:focus,
.success-content button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}
