/* css/sidebar.css - v1.3 - Sidebar responsiva, legível e pronta para temas */

/* --- Sidebar fixa --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    background-color: var(--secondary-color);
    border-right: 3px solid var(--primary-color);
    z-index: 1050;
    transition: left 0.3s, box-shadow 0.3s, background-color 0.3s;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.12);
}

/* Sidebar oculta no mobile */
@media (max-width: 992px) {
    .sidebar {
        left: -250px;
        box-shadow: none;
    }
    .sidebar.sidebar-mobile-visible {
        left: 0;
        box-shadow: 2px 0 18px rgba(0,0,0,0.18);
    }
}

/* Overlay */
.sidebar-overlay {
    display: none;
}
@media (max-width: 992px) {
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.55);
        z-index: 1045;
        display: none;
        transition: opacity 0.3s;
    }
    .sidebar-overlay.active {
        display: block;
    }
}

/* Botão de abrir menu sempre fixo no topo */
.sidebar-toggle {
    display: none;
}
@media (max-width: 992px) {
    .sidebar-toggle {
        display: flex;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1100;
        background-color: var(--primary-color);
        color: var(--text-light);
        border: none;
        border-radius: 4px;
        width: 40px;
        height: 40px;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.20);
    }
}

/* --- Logo --- */
.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    background: transparent;
}
.sidebar-brand a {
    color: var(--primary-color);
    font-size: 1.5em;
    font-weight: bold;
    text-decoration: none;
    text-shadow: 0 0 8px var(--shadow-color-hover);
}

/* --- Navegação --- */
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-bottom: 80px;
}
.sidebar-nav-item {
    margin: 5px 15px;
}
.sidebar-nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 4px;
    transition: background 0.3s, color 0.3s;
    display: flex;
    align-items: center;
}
.sidebar-nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    font-size: 1.1em;
}
.sidebar-nav-link:hover,
.sidebar-nav-item.active .sidebar-nav-link {
    background-color: var(--primary-color);
    color: #fff;
}

/* --- Usuário --- */
.sidebar-user {
    position: absolute;
    bottom: 60px;
    left: 0;
    right: 0;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.11);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-info {
    display: flex;
    align-items: center;
    flex: 1;
}
.user-info i {
    font-size: 2em;
    color: var(--primary-color);
    margin-right: 10px;
}
.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.user-name {
    color: var(--text-color);
    font-weight: bold;
    font-size: 0.93em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-email {
    color: var(--text-muted);
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logout-btn {
    color: var(--text-muted);
    font-size: 1.15em;
    padding: 8px;
    border-radius: 4px;
    transition: color 0.3s, background 0.3s;
    text-decoration: none;
}
.logout-btn:hover {
    color: var(--primary-color);
    background-color: rgba(255, 51, 102, 0.08);
    text-decoration: none;
}

/* --- Footer --- */
.sidebar-footer {
    padding: 15px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 0.92em;
    color: var(--text-muted);
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--secondary-color);
}

/* Responsividade Usuário/Footer */
@media (max-width: 992px) {
    .sidebar-user {
        position: relative;
        bottom: auto;
        margin-top: 20px;
    }
}

/* Temas claros: Itaú/Nubank */
[data-theme="itau"] .sidebar,
[data-theme="itau"] .sidebar-footer,
[data-theme="itau"] .sidebar-user {
    background-color: var(--secondary-color) !important;
}
[data-theme="itau"] .sidebar-nav-link,
[data-theme="itau"] .user-email {
    color: var(--text-dark) !important;
}
[data-theme="itau"] .sidebar-nav-link:hover,
[data-theme="itau"] .sidebar-nav-item.active .sidebar-nav-link {
    background: var(--primary-color) !important;
    color: #fff !important;
}

[data-theme="nubank"] .sidebar,
[data-theme="nubank"] .sidebar-footer,
[data-theme="nubank"] .sidebar-user {
    background-color: var(--secondary-color) !important;
}
[data-theme="nubank"] .sidebar-nav-link,
[data-theme="nubank"] .user-email {
    color: var(--text-dark) !important;
}
[data-theme="nubank"] .sidebar-nav-link:hover,
[data-theme="nubank"] .sidebar-nav-item.active .sidebar-nav-link {
    background: var(--primary-color) !important;
    color: #fff !important;
}
