/* Variáveis CSS */
:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --transition-speed: 0.3s;
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
}

/* Layout Base */
body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    min-height: 100vh;
    overflow-x: hidden;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    transition: all var(--transition-speed) ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-brand .logo-icon {
    font-size: 1.8rem;
}

.sidebar-brand .logo-text {
    line-height: 1.2;
}

.sidebar-body {
    padding: 1rem 0;
    height: calc(100vh - 180px);
    overflow-y: auto;
}

/* Scrollbar personalizada */
.sidebar-body::-webkit-scrollbar {
    width: 5px;
}

.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.user-profile {
    padding: 0 1rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 50px;
    height: 50px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-link {
    padding: 0.75rem 1.5rem;
    color: var(--bs-body-color);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--bs-primary);
}

.nav-link.active {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    color: var(--bs-primary);
    border-left-color: var(--bs-primary);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--bs-border-color);
    position: absolute;
    bottom: 0;
    width: 100%;
    background: var(--bs-body-bg);
}

.theme-switcher {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) ease;
}

.main-content {
    min-height: calc(100vh - 120px);
}

/* Top Navbar */
.navbar {
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Footer */
.footer {
    background-color: var(--bs-light);
}

/* Responsividade */
@media (max-width: 992px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.show {
        margin-left: 0;
    }
    
    .content-wrapper {
        margin-left: 0 !important;
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1029;
    }
    
    .overlay.show {
        display: block;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

body.loading .loading-overlay {
    display: flex;
}

.spinner-container {
    text-align: center;
}

/* Cards */
.card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.card-header {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Botões */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(var(--bs-primary-rgb), 0.2);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Formulários */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Tabelas */
.table {
    --bs-table-striped-bg: rgba(0,0,0,0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

/* Alertas */
.alert {
    border-radius: 0.5rem;
    border: 1px solid transparent;
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--bs-secondary);
}

/* Skip Link (Acessibilidade) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--bs-primary);
    color: white;
    padding: 8px;
    z-index: 9999;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .footer,
    .btn,
    .dropdown,
    .theme-switcher {
        display: none !important;
    }
    
    .content-wrapper {
        margin-left: 0 !important;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
    
    a {
        color: #000 !important;
        text-decoration: none !important;
    }
}