/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Modo Claro */
body.light-mode {
    background-color: #f5f7fa;
    color: #2d3748;
}

/* Modo Escuro */
body.dark-mode {
    background-color: #1a202c;
    color: #e2e8f0;
}

/* Header */
.header {
    width: 100%;
    margin-left: 0;
    z-index: 1100;
    background: linear-gradient(135deg, #2196f3, #42a5f5);
    transition: box-shadow 0.3s, background 0.3s;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    animation: fadeInHeader 0.6s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 64px;
}

body.dark-mode .header {
    background: linear-gradient(135deg, #1565c0, #1e88e5);
}

@keyframes fadeInHeader {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.header:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.header .nav-wrapper {
    position: relative;
    height: 64px;
}

/* Logo fixo na extrema esquerda */
.header .brand-logo.logo-absolute {
    position: absolute;
    top: 0;
    left: 0;
    padding-left: 4%;
    margin-left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 2;
}

.header .header-logo {
    max-height: 75px;
    margin-left: 0;
    padding-left: 0;
}

.header .header-title.center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 64px;
    transition: font-size 0.3s;
}

.header .nav-wrapper ul.right {
    display: flex;
    align-items: center;
    height: 64px;
}

/* Nome do Usuário com Hover */
.user-menu {
    position: relative;
}

.user-name {
    padding: 0 15px;
    line-height: 64px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.user-dropdown {
    position: relative;
}

.profile-button {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    color: #2196f3;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
}

.user-dropdown:hover .profile-button {
    display: block;
}

body.dark-mode .profile-button {
    background-color: #2d3748;
    color: #64b5f6;
}

/* Botão de Tema Flutuante */
.fixed-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1500;
}

.theme-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.3s, color 0.3s, transform 0.2s;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(33, 150, 243, 0.3);
}

body.dark-mode .theme-switch {
    background: rgba(45, 55, 72, 0.9);
    border: 1px solid rgba(100, 181, 246, 0.3);
}

body.light-mode .theme-switch {
    color: #2196f3;
}

body.dark-mode .theme-switch {
    color: #64b5f6;
}

.theme-switch:hover {
    background: rgba(33, 150, 243, 0.2);
    transform: scale(1.1);
}

.theme-switch i {
    font-size: 26px;
}

/* Sidenav */
.sidenav.sidenav-fixed {
    top: 64px;
    height: calc(100vh - 64px);
    width: 250px;
    position: fixed;
    z-index: 1000;
    border-radius: 0 12px 12px 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease;
    overflow-y: auto;
    transition: width 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.sidenav.white {
    background-color: #fff !important;
}

body.dark-mode .sidenav,
body.dark-mode .sidenav.dark-sidenav {
    background-color: #1e1e1e !important;
}

.sidenav.collapsed {
    width: 50px;
}

.sidenav.collapsed .sidenav-content {
    display: none;
}

/* Ajuste para o botão de toggle */
.sidenav .user-view {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0;
    z-index: 1101;
}

.sidenav .user-view a#sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 48px;
    color: #2d3748;
    text-decoration: none;
    transition: background-color 0.3s;
}

body.dark-mode .sidenav .user-view a#sidebar-toggle {
    color: #64b5f6;
}

.sidenav .user-view a#sidebar-toggle:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
}

.sidenav.collapsed .user-view {
    display: flex;
}

.sidenav.collapsed #sidebar-toggle i {
    transform: rotate(180deg);
}

/* Menu Items */
.sidenav .menu-item {
    margin: 4px 8px;
}

.sidenav .menu-header {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.3s, transform 0.2s;
    color: #2d3748;
}

body.dark-mode .sidenav .menu-header {
    color: #64b5f6;
}

.sidenav .menu-header:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
    transform: translateX(4px);
}

.sidenav .menu-header i {
    margin-right: 12px;
    color: #2d3748;
    transition: transform 0.2s;
}

body.dark-mode .sidenav .menu-header i {
    color: #64b5f6;
}

.sidenav .menu-header:hover i {
    transform: scale(1.2);
}

.sidenav .menu-header::after {
    content: '▼';
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
    color: #2d3748;
}

body.dark-mode .sidenav .menu-header::after {
    color: #64b5f6;
}

.sidenav .menu-item.active .menu-header::after {
    transform: rotate(180deg);
}

/* Submenu */
.sidenav .submenu {
    display: none;
    list-style: none;
    background-color: #fff;
    border-radius: 8px;
    margin: 0 8px;
    padding: 4px 0;
    width: calc(100% - 16px);
}

body.dark-mode .sidenav .submenu {
    background-color: #1e1e1e !important;
}

.sidenav .menu-item.active .submenu {
    display: block;
}

.sidenav .submenu li a,
.sidenav .submenu li span.no-items {
    display: flex;
    align-items: center;
    padding: 12px 16px 12px 36px;
    color: #2d3748;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.5;
}

body.dark-mode .sidenav .submenu li a,
body.dark-mode .sidenav .submenu li span.no-items {
    color: #64b5f6 !important;
}

.sidenav .submenu li a:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
}

.sidenav .submenu li a i,
.sidenav .submenu li span.no-items i {
    margin-right: 12px;
    color: #2d3748;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

body.dark-mode .sidenav .submenu li a i,
body.dark-mode .sidenav .submenu li span.no-items i {
    color: #64b5f6 !important;
}

/* Estilos Gerais do Sidenav */
.sidenav li > a {
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    color: #2d3748;
    text-decoration: none;
    border-radius: 8px;
    margin: 4px 8px;
    transition: background-color 0.3s, transform 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: calc(100% - 16px);
}

body.dark-mode .sidenav li > a {
    color: #64b5f6 !important;
}

.sidenav li > a:hover {
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
    transform: translateX(4px);
}

.sidenav li > a i {
    margin-right: 12px;
    color: #2d3748;
    transition: transform 0.2s;
    width: 24px;
    text-align: center;
}

body.dark-mode .sidenav li > a i {
    color: #64b5f6 !important;
}

.sidenav li > a:hover i {
    transform: scale(1.2);
}

/* Ajustes Existentes Mantidos */
.sidenav .divider {
    margin: 8px 0;
}

/* Conteúdo Principal */
main.content {
    margin-left: 250px;
    padding: 2rem;
    transition: margin-left 0.3s;
    overflow-y: auto;
    height: calc(100vh - 64px);
    padding-top: 80px;
}

body.light-mode .content {
    background-color: #f5f7fa;
}

body.dark-mode .content {
    background-color: #1a202c;
}

.sidenav.sidenav-fixed.collapsed ~ .content {
    margin-left: 50px;
}

/* Estilos para Tabelas */
table {
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
}

body.dark-mode table {
    background-color: #2d3748;
}

table tr {
    transition: background-color 0.2s;
}

body.light-mode table tr {
    background-color: #ffffff;
    color: #2d3748;
}

body.dark-mode table tr {
    background-color: #2d3748;
    color: #e2e8f0;
}

table tr:hover,
table tr.highlight,
table tr.selected {
    background-color: #e3f2fd !important;
    color: #2d3748 !important;
}

body.dark-mode table tr:hover,
body.dark-mode table tr.highlight,
body.dark-mode table tr.selected {
    background-color: #4a5568 !important;
    color: #e2e8f0 !important;
}

table td, table th {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

body.dark-mode table td,
body.dark-mode table th {
    border-bottom: 1px solid #4a5568;
}

/* Dashboard */
.card {
    border-radius: 12px;
    transition: transform 0.3s, box-shadow 0.3s;
    animation: cardFadeIn 0.6s ease;
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

body.light-mode .card.white {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
}

body.dark-mode .card.dark-bg {
    background: linear-gradient(135deg, #2d3748, #1e1e1e) !important;
}

body.dark-mode .card .dark-text {
    color: #e2e8f0 !important;
}

body.dark-mode .card .dark-text-secondary {
    color: #a0aec0 !important;
}

body.dark-mode .dark-grey {
    background: linear-gradient(135deg, #4a5568, #2d3748) !important;
    color: #e2e8f0 !important;
}

.card-content {
    padding: 1.5rem !important;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Botões do Dashboard */
.btn {
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .btn.green.darken-2 {
    background-color: #43a047 !important;
}

body.dark-mode .btn.green.darken-2:hover {
    background-color: #4caf50 !important;
}

/* Responsividade */
@media (max-width: 992px) {
    .header {
        width: 100%;
        margin-left: 0;
    }
    .header .brand-logo {
        font-size: 1.5rem;
    }
    .header .header-title {
        font-size: 1.5rem;
    }
    .sidenav.sidenav-fixed {
        width: 50px;
        transform: translateX(0);
        position: fixed;
        top: 64px;
        height: calc(100vh - 64px);
    }
    .sidenav.sidenav-fixed.active {
        width: 250px;
        transform: translateX(0);
        z-index: 1000;
        position: fixed;
    }
    .sidenav.collapsed {
        width: 50px;
        transform: translateX(0);
    }
    main.content {
        margin-left: 50px;
        padding: 1rem;
        height: calc(100vh - 64px);
        padding-top: 80px;
    }
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .header .brand-logo {
        font-size: 1.3rem;
    }
    .header .header-logo {
        max-height: 32px;
    }
    .header .header-title {
        font-size: 1.3rem;
    }
    .card-content {
        padding: 1rem !important;
    }
    .btn {
        padding: 0 1rem;
    }
    .user-name {
        font-size: 0.9rem;
        padding: 0 10px;
    }
    .fixed-theme-toggle {
        display: none;
    }
}

/* Estilos para selects nas telas de conciliação */
.input-field select.conciliation-select {
    display: block;
    width: 300px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-top: 1rem;
    box-sizing: border-box;
    appearance: none;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path fill="%236b7280" d="M7 10l5 5 5-5z"/></svg>') no-repeat right 0.75rem center;
    background-size: 12px;
    cursor: pointer;
    padding-right: 2rem;
}

body.dark-mode .input-field select.conciliation-select {
    border-color: #4b5563;
    background-color: #2d3748;
    color: #e5e7eb;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path fill="%239ca3af" d="M7 10l5 5 5-5z"/></svg>') no-repeat right 0.75rem center;
}

.input-field select.conciliation-select:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.2);
}