/* Reset e estrutura */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    height: 100%;
    overflow: hidden;
}
.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.top-bar {
    height: 60px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}
.layout-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.sidebar {
    width: 250px;
    background-color: #343a40;
    color: #fff;
    transition: width 0.3s;
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar.collapsed {
    width: 70px;
}
.sidebar.collapsed .menu-text,
.sidebar.collapsed .sub-arrow {
    display: none;
}
.sidebar.collapsed .menu-link {
    justify-content: center;
}
.sidebar.collapsed .menu-link i {
    margin-right: 0;
}
.menu {
    padding: 10px 0;
}
.menu-item {
    margin-bottom: 2px;
}
.menu-link {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    color: #fff;
    text-decoration: none;
    transition: background 0.2s;
}
.menu-link:hover {
    background-color: rgba(255,255,255,0.1);
}
.menu-link i {
    width: 24px;
    margin-right: 10px;
}
.menu-text {
    flex: 1;
}
.sub-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s;
}
.menu-item.active .sub-arrow {
    transform: rotate(180deg);
}
.submenu {
    background-color: #2c3136;
    padding-left: 45px;
    display: none;
}
.submenu-link {
    display: block;
    padding: 8px 15px;
    color: #ddd;
    text-decoration: none;
}
.submenu-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f5f5f5;
    transition: margin-left 0.3s;
}
.app-footer {
    background-color: #f8f9fa;
    text-align: center;
    padding: 10px;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
}

/* ====================== Tema escuro (completo) ====================== */
body.dark-theme {
    background-color: #121212;
    color: #e0e0e0;
}
body.dark-theme .top-bar,
body.dark-theme .app-footer {
    background-color: #1e1e2f;
    border-color: #2c2c3a;
}
body.dark-theme .sidebar {
    background-color: #1a1a2a;
}
body.dark-theme .submenu {
    background-color: #12121e;
}
body.dark-theme .main-content {
    background-color: #1e1e2f;
}
body.dark-theme .card {
    background-color: #2c2c3a;
    border-color: #3a3a4a;
}
body.dark-theme .card-title,
body.dark-theme .card-text {
    color: #e0e0e0;
}
body.dark-theme .table {
    color: #e0e0e0;
}
body.dark-theme .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}
body.dark-theme .table-hover > tbody > tr:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
body.dark-theme .table thead th {
    background-color: #1e1e2f;
    color: #e0e0e0;
    border-color: #3a3a4a;
}
body.dark-theme .form-control,
body.dark-theme .form-select {
    background-color: #2c2c3a;
    border-color: #3a3a4a;
    color: #e0e0e0;
}
body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background-color: #2c2c3a;
    color: #e0e0e0;
    border-color: #6c757d;
}
body.dark-theme .form-label {
    color: #e0e0e0;
}
body.dark-theme .btn-light {
    background-color: #3a3a4a;
    border-color: #4a4a5a;
    color: #e0e0e0;
}
body.dark-theme .btn-light:hover {
    background-color: #4a4a5a;
    color: #fff;
}
body.dark-theme .btn-outline-secondary {
    color: #e0e0e0;
    border-color: #4a4a5a;
}
body.dark-theme .btn-outline-secondary:hover {
    background-color: #4a4a5a;
    color: #fff;
}
body.dark-theme .alert-success {
    background-color: #1e4620;
    border-color: #2e6b2f;
    color: #c8e6c9;
}
body.dark-theme .alert-danger {
    background-color: #5a1e1e;
    border-color: #8b3c3c;
    color: #ffcdd2;
}
body.dark-theme .dropdown-menu {
    background-color: #2c2c3a;
    border-color: #3a3a4a;
}
body.dark-theme .dropdown-item {
    color: #e0e0e0;
}
body.dark-theme .dropdown-item:hover {
    background-color: #3a3a4a;
    color: #fff;
}
body.dark-theme .modal-content {
    background-color: #2c2c3a;
    border-color: #3a3a4a;
}
body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    border-color: #3a3a4a;
}
body.dark-theme .modal-title {
    color: #e0e0e0;
}
/* Corrige textos que usam classes do Bootstrap */
body.dark-theme .text-dark {
    color: #e0e0e0 !important;
}
body.dark-theme .text-muted {
    color: #b0b0b0 !important;
}
body.dark-theme .navbar-brand {
    color: #e0e0e0 !important;
}
body.dark-theme .navbar-brand:hover {
    color: #fff !important;
}
body.dark-theme .btn-link {
    color: #e0e0e0;
}
body.dark-theme .btn-link:hover {
    color: #fff;
}
body.dark-theme .page-link {
    background-color: #2c2c3a;
    border-color: #3a3a4a;
    color: #e0e0e0;
}
body.dark-theme .page-link:hover {
    background-color: #3a3a4a;
    color: #fff;
}
body.dark-theme .pagination .page-item.active .page-link {
    background-color: #0d6efd;
    border-color: #0d6efd;
}