/* Estilos para o Sistema SPA */

/* Loading Overlay */
.spa-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.spa-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.spa-loading-content .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

.spa-loading-content div:last-child {
    color: #6c757d;
    font-weight: 500;
    font-size: 1rem;
}

/* Smooth transitions for content changes */
.content-body {
    transition: opacity 0.2s ease-in-out;
}

.content-body.spa-loading {
    opacity: 0.7;
}

/* Sidebar improvements for SPA */
.sidebar-link {
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-link:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
}

.sidebar-link.active {
    background-color: rgba(13, 110, 253, 0.2);
    color: var(--bs-primary);
    border-left: 3px solid var(--bs-primary);
}

.sidebar-link.active i {
    color: var(--bs-primary);
}

/* Loading state for individual links */
.sidebar-link.loading {
    opacity: 0.6;
    pointer-events: none;
}

.sidebar-link.loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spa-spin 1s linear infinite;
}

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

/* Content area improvements */
.main-content {
    position: relative;
    overflow-x: hidden;
}

/* Fade-in animation for new content */
@keyframes spa-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spa-content-loaded {
    animation: spa-fade-in 0.3s ease-out;
}

/* Progress bar for page loading */
.spa-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--bs-primary), var(--bs-info));
    z-index: 10000;
    transition: width 0.3s ease;
}

.spa-progress-bar.loading {
    animation: spa-progress 2s ease-in-out infinite;
}

@keyframes spa-progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Responsive improvements */
@media (max-width: 768px) {
    .spa-loading-content {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .spa-loading-content .spinner-border {
        width: 2rem;
        height: 2rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .spa-loading-overlay,
    .content-body,
    .sidebar-link,
    .spa-content-loaded {
        transition: none;
        animation: none;
    }
    
    .spa-progress-bar {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .spa-loading-overlay {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: none;
    }
    
    .spa-loading-content {
        border: 2px solid #000;
    }
}

/* Focus styles for keyboard navigation */
.sidebar-link:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Error states */
.spa-error {
    border-left: 4px solid #dc3545;
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.25rem;
}

.spa-error-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.spa-error-message {
    margin: 0;
}

/* Success states */
.spa-success {
    border-left: 4px solid #28a745;
    background-color: #d4edda;
    color: #155724;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.25rem;
}