/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background: linear-gradient(180deg, #0f1a2b 0%, #14213d 100%);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.35);
}

.sidebar.collapsed {
    width: 100px;
}

.sidebar-header {
    padding: 24px 28px;
    text-align: left;
    color: #e0e6ed;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #111d33;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #87cefa;
}

.sidebar-brand i {
    font-size: 1.45rem;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

#sidebarCollapse {
    color: #e0e6ed;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    opacity: 0.8;
}

#sidebarCollapse:hover {
    opacity: 1;
    color: black;
}

/* Botão fechar sidebar mobile */
#sidebarClose {
    color: #e0e6ed;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    opacity: 0.8;
    padding: 5px 10px;
}

#sidebarClose:hover {
    opacity: 1;
    color: purple;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 18px 28px;
    color: #e0e6ed;
    text-decoration: none;
    transition: background 0.3s;
    font-size: 0.9rem;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: #1a2540;
    color: #24f3f3;
}

.sidebar-menu li a i {
    font-size: 1.1rem;
    width: 38px;
    text-align: center;
    margin-right: 10px;
}

.sidebar.collapsed .sidebar-menu li a span {
    display: none;
}

.sidebar.collapsed .sidebar-menu li a {
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu li a i {
    margin-right: 0;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .sidebar-link,
.sidebar-footer form button {
    display: flex;
    align-items: center;
    padding: 10px 0;
    color: #fff;
    text-decoration: none;
    transition: background 0.3s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.sidebar-footer .sidebar-link:hover,
.sidebar-footer form button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer .sidebar-link i,
.sidebar-footer form button i {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
    margin-right: 10px;
}

.sidebar.collapsed .sidebar-footer .sidebar-link span,
.sidebar.collapsed .sidebar-footer form button span {
    display: none;
}

/* Main Content */
#content {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background: var(--finapp-bg);
    box-sizing: border-box;
}

#content.expanded {
    margin-left: 100px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Toast Styles */
.toast {
    min-width: 300px;
}

.toast-success {
    border-left: 4px solid #28a745;
}

.toast-success,
.toast-success .toast-header,
.toast-success .toast-body {
    color: #111827;
}

.toast-error {
    border-left: 4px solid #dc3545;
}

.toast-error,
.toast-error .toast-header,
.toast-error .toast-body {
    color: #111827;
}

.toast-warning {
    border-left: 4px solid #ffc107;
}

.toast-warning,
.toast-warning .toast-header,
.toast-warning .toast-body {
    color: #111827;
}

.toast-info {
    border-left: 4px solid #17a2b8;
}

.toast-info,
.toast-info .toast-header,
.toast-info .toast-body {
    color: #111827;
}

/* Year-Month Selector */
.year-month-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.selector-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar.finapp-topbar {
    background: linear-gradient(180deg, #0f1a2b 0%, #111d33 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.navbar.finapp-topbar .btn,
.navbar.finapp-topbar .dropdown-toggle {
    border-color: #2a3a57;
    color: #e0e6ed;
}

.navbar.finapp-topbar .btn-outline-light {
    border-color: #2a3a57;
    color: #e0e6ed;
    background: #0f1625;
}

.navbar.finapp-topbar .btn-outline-light:hover {
    border-color: #24f3f3;
    color: #24f3f3;
}

.navbar.finapp-topbar .dropdown-toggle {
    background: #0f1625;
}

.navbar.finapp-topbar .dropdown-menu {
    background: #111827;
    border-color: #2a3a57;
}

.navbar.finapp-topbar .dropdown-item {
    color: #e0e6ed;
}

.navbar.finapp-topbar .dropdown-item:hover,
.navbar.finapp-topbar .dropdown-item:focus {
    background: #1a2540;
    color: pink;
}

.mes-btn.active {
    background-color: #068585 !important;
    color: #ffffff !important;
    border-color: #068585 !important;
}

.year-month-selector .mes-btn:focus,
.year-month-selector .mes-btn:active,
.year-month-selector .mes-nav-btn:focus,
.year-month-selector .mes-nav-btn:active,
.year-month-selector .ano-btn:focus,
.year-month-selector .ano-btn:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Botão menu mobile - oculto por padrão em desktop */
.mobile-menu-btn,
.finapp-topbar .mobile-menu-btn,
.navbar .mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid #2a3a57;
    border-radius: 6px;
    color: #e0e6ed;
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 10px;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: #1a2540;
    color: red;
}

/* Responsive - Tablets */
@media (max-width: 992px) {
    .sidebar {
        width: 100px;
    }

    .sidebar .sidebar-brand span,
    .sidebar .sidebar-menu li a span,
    .sidebar .sidebar-footer .sidebar-link span,
    .sidebar .sidebar-footer form button span {
        display: none;
    }

    .sidebar .sidebar-menu li a {
        justify-content: center;
    }

    .sidebar .sidebar-menu li a i {
        margin-right: 0;
    }

    #content {
        margin-left: 100px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    /* Sidebar como overlay em mobile */
    .sidebar {
        width: 300px;
        transform: translateX(-100%);
        margin-left: 0;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar .sidebar-brand span,
    .sidebar .sidebar-menu li a span,
    .sidebar .sidebar-footer .sidebar-link span,
    .sidebar .sidebar-footer form button span {
        display: inline;
    }

    .sidebar .sidebar-menu li a {
        justify-content: flex-start;
    }

    .sidebar .sidebar-menu li a i {
        margin-right: 10px;
    }

    #content {
        margin-left: 0;
    }

    #content.expanded {
        margin-left: 0;
    }

    /* Overlay escuro quando sidebar aberta */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Botão menu mobile na topbar - FORÇAR exibição em mobile */
    .mobile-menu-btn,
    .finapp-topbar .mobile-menu-btn,
    .navbar .mobile-menu-btn,
    button.mobile-menu-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Year-Month Selector Responsive */
@media (max-width: 768px) {
    /* Topbar flex container - tudo na mesma linha */
    .finapp-topbar .container-fluid {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 8px;
    }

    .year-month-selector {
        flex: 1;
        min-width: 0;
    }

    .year-month-selector .selector-container {
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: flex-start;
    }

    /* Esconder botões de mês em mobile, usar dropdown */
    .year-month-selector .btn-group .mes-btn {
        display: none;
    }

    .year-month-selector .btn-group {
        display: flex;
    }

    .year-month-selector .mes-nav-btn {
        display: flex !important;
    }

    /* Mostrar dropdown de mês em mobile */
    .mes-dropdown-mobile {
        display: flex !important;
    }

    /* Ajustar tamanhos para caber na linha */
    .year-month-selector .ano-btn {
        min-width: 70px;
        padding: 6px 10px;
        font-size: 0.9rem;
    }

    .year-month-selector .mes-nav-btn {
        min-width: 36px;
        padding: 6px 8px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .year-month-selector .mes-nav-btn i {
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #dropdownMesMobile .btn {
        min-width: 60px;
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

/* Dropdown de mês mobile - oculto por padrão */
.mes-dropdown-mobile {
    display: none !important;
}

@media (min-width: 769px) {
    .mes-dropdown-mobile {
        display: none !important;
    }
}
