/* =======================================================
 * 0. VARIÁVEIS GLOBAIS (PADRÃO COMUNIDADE)
 * ======================================================= */
:root {
    --primary-color: #53954a;
    --primary-hover: #3e7536;
    --bg-color: #f0f2f5;
    --white: #ffffff;
    --text-color: #050505;
    --text-secondary: #65676b;
    --border-light: #e4e6eb; /* Cor exata da borda */
}

/* =======================================================
 * 1. RESET E LAYOUT GERAL
 * ======================================================= */
* { box-sizing: border-box; }
.dashboard-body { background-color: var(--bg-color); font-family: 'Lato', sans-serif; color: var(--text-color); margin: 0; overflow-x: hidden; overflow-y: scroll; }
.main-layout { display: flex; flex-direction: row; width: 100vw; min-height: 100vh; max-width: none; margin: 0; padding: 0; gap: 0; background: #fff; }

/* =======================================================
 * 2. SIDEBAR ESQUERDA (SEM SCROLL)
 * ======================================================= */
.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    
    /* BLOQUEIA SCROLL TOTALMENTE */
    overflow: hidden !important; 
    z-index: 100;
}

/* Garantia extra para esconder scrollbars em navegadores teimosos */
.sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sidebar { -ms-overflow-style: none; scrollbar-width: none; }

.logo-area { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; padding-left: 4px; flex-shrink: 0; }
.sidebar-logo-img { width: 34px; height: auto; }
.brand-text { font-family: 'Montserrat', sans-serif; font-weight: 800; color: var(--primary-color); font-size: 1rem; }
.brand-text span { color: #6e513d; }

/* Busca de usuarios na sidebar (padrao unificado) */
.sidebar-search,
.mobile-menu-search {
    padding: 10px 15px;
    position: relative;
}

.sidebar-search i,
.mobile-menu-search i {
    position: absolute;
    top: 50%;
    left: 28px;
    transform: translateY(-50%);
    color: #aaa;
}

.sidebar-search input,
.mobile-menu-search input {
    width: 100%;
    padding: 8px 8px 8px 35px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background-color: #f0f2f5;
    font-family: 'Lato', sans-serif;
}

.mobile-menu-search input {
    background-color: #fff;
}

.nav-links { list-style: none; padding: 0; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.nav-links a { text-decoration: none; color: var(--text-secondary); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 0.9rem; transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; position: relative; }
.nav-links a:hover { background-color: #f7f9fa; color: var(--primary-color); }
.nav-links a.active { background-color: #e8f5e9; color: var(--primary-color); font-weight: 700; }
.nav-links a i { font-size: 1.15rem; width: 22px; text-align: center; }

.icon-container { position: relative; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.nav-badge { position: absolute; top: -5px; right: -6px; background-color: #ff3b30; color: white; font-size: 0.6rem; font-weight: 800; min-width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; z-index: 10; }
.nav-badge.hidden { display: none; }

.nav-footer { margin-top: auto; border-top: 1px solid var(--border-light); padding-top: 16px; flex-shrink: 0; }
.profile-pill-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text-color); padding: 8px; border-radius: 12px; }
.profile-pill-link:hover { background-color: #f7f9fa; }
.nav-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.profile-info-mini { display: flex; align-items: center; gap: 4px; min-width: 0; }
.profile-info-mini span { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =======================================================
 * MOBILE HEADER + DRAWER + NAVBAR
 * ======================================================= */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 150;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #ececec;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mobile-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mobile-logo { width: 30px; height: 30px; }
.mobile-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.mobile-brand-text strong { font-size: 0.9rem; color: #222; }
.mobile-brand-text span { font-size: 0.72rem; color: #777; }

.icon-btn {
    background: #f3f4f6;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #222;
}

.mobile-avatar-link,
.mobile-avatar { width: 40px; height: 40px; border-radius: 50%; }
.mobile-avatar { object-fit: cover; border: 2px solid #f2f2f2; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    z-index: 160;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mobile-menu-overlay.open { display: flex; opacity: 1; pointer-events: auto; }

.mobile-menu {
    width: 82%;
    max-width: 360px;
    height: 100%;
    background: #fff;
    box-shadow: 8px 0 24px rgba(0,0,0,0.08);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.mobile-menu-overlay.open .mobile-menu { transform: translateX(0); }
.mobile-menu-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mobile-user { display: flex; align-items: center; gap: 12px; }
.mobile-menu-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.mobile-user-text strong { display: block; font-size: 0.95rem; color: #222; }
.mobile-user-text span { font-size: 0.8rem; color: #777; }

.mobile-nav-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.mobile-nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #f1f1f1;
    color: #222;
    font-weight: 700;
    background: #fafafa;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.mobile-nav-links a.active { background: #e8f5e9; border-color: #b8dec0; color: #53954a; }

.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 68px;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
    z-index: 140;
    padding: 8px 10px;
    gap: 6px;
    justify-content: space-between;
}

.bottom-nav .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #777;
    font-weight: 700;
    font-size: 0.72rem;
    text-decoration: none;
    border-radius: 12px;
    padding: 6px 4px;
}

.bottom-nav .bn-item.active { color: #53954a; background: #e8f5e9; }

/* =======================================================
 * 3. ÁREA CENTRAL
 * ======================================================= */
.content-area { 
    padding: 30px 40px; 
    width: 100%; 
    max-width: none; 
    margin: 0; 
    display: flex; 
    flex-direction: column; 
    flex: 1; 
    min-width: 0; 
    overflow-y: auto; 
}

/* Barra de Busca */
.top-search-bar {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.top-search-bar input { border: none; outline: none; width: 100%; font-size: 1rem; color: #333; }
.top-search-bar i { color: #888; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.page-header h2 { font-size: 1.5rem; color: var(--text-color); margin: 0; font-weight: 800; }
.btn-link-action { background: none; border: none; color: var(--primary-color); font-weight: 700; cursor: pointer; font-size: 0.9rem; }
.btn-link-action:hover { text-decoration: underline; }

/* Notificações */
.notif-item {
    background: white; border-radius: 12px; padding: 15px; margin-bottom: 10px;
    display: flex; align-items: center; gap: 15px; transition: background 0.2s;
    cursor: pointer; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.notif-item:hover { background-color: #fafafa; }
.notif-item.unread { background-color: #e8f5e9; border-left: 4px solid var(--primary-color); }
.notif-item.unread::after { content: ''; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); width: 10px; height: 10px; background-color: var(--primary-color); border-radius: 50%; }
.notif-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.notif-content { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.notif-text { font-size: 0.95rem; color: var(--text-color); line-height: 1.4; }
.notif-text strong { font-weight: 700; }
.notif-time { font-size: 0.8rem; color: var(--text-secondary); }
.skeleton-notif { height: 80px; background: #e0e0e0; margin-bottom: 10px; border-radius: 12px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

/* =======================================================
 * 4. SIDEBAR DIREITA
 * ======================================================= */
.right-sidebar { 
    width: 340px; background: white; padding: 30px 25px; 
    position: sticky; top: 0; height: 100vh; overflow-y: auto; 
    border-left: 1px solid var(--border-light); 
    display: flex; flex-direction: column; flex-shrink: 0; 
}
.widget-header h3 { margin: 0 0 20px 0; font-size: 1.1rem; color: #333; font-weight: 800; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.ranking-widget { flex: 1; display: flex; flex-direction: column; }
.ranking-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-right: 5px; }
.ranking-list::-webkit-scrollbar { display: none; }
.ranking-item { display: flex; align-items: center; gap: 15px; padding: 10px; border-radius: 12px; transition: 0.2s; }
.ranking-item:hover { background-color: #f9f9f9; }
.rank-avatar-wrapper { position: relative; }
.rank-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.rank-info { flex: 1; }
.rank-info h4 { margin: 0; font-size: 0.95rem; color: #0f1419; font-weight: 700; }
.rank-xp { font-size: 0.8rem; color: var(--primary-color); font-weight: 700; }
.ranking-footer { margin-top: 20px; text-align: center; }
.footer-links-mini { font-size: 0.75rem; color: #ccc; text-align: center; margin-top: auto; padding-top: 20px; }

/* =======================================================
 * 5. MODAIS (Estilo Core)
 * ======================================================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.75); backdrop-filter: blur(4px); display: none; justify-content: center; align-items: center; z-index: 20000; }
.modal-overlay.open { display: flex; }
.modal-content-tools { background: white; width: 95%; max-width: 800px; border-radius: 20px; padding: 30px; animation: scaleUp 0.3s ease; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-header-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; border-bottom: 1px solid var(--border-light); padding-bottom: 15px; }
.modal-header-tools h3 { font-size: 1.5rem; margin: 0; color: var(--primary-color); display: flex; align-items: center; gap: 10px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.tool-card { background: #f8fcf8; border: 1px solid var(--border-light); border-radius: 15px; padding: 25px; text-align: center; transition: 0.3s; }
.tool-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); border-color: var(--primary-color); }
.tool-icon { width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 15px auto; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.water-icon { background: #e3f2fd; color: #2196f3; }
.imc-icon { background: #e8f5e9; color: var(--primary-color); }
.tool-card h4 { margin: 0 0 5px 0; font-size: 1.2rem; color: #333; }
.tool-card p { margin: 0 0 20px 0; font-size: 0.9rem; color: #666; }
.tool-input-area .input-wrapper-calc { margin-bottom: 10px; background: white; border: 1px solid #ddd; padding: 0 10px; border-radius: 8px; display: flex; align-items: center; }
.tool-input-area input { font-size: 1.1rem; text-align: center; width: 100%; border: none; padding: 12px; outline: none; }
.input-row { display: flex; gap: 10px; margin-bottom: 10px; }
.mini-input { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #ddd; text-align: center; outline: none; }
.btn-tool-action { width: 100%; background: var(--primary-color); color: white; border: none; padding: 12px; border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-tool-action:hover { background: #3e7536; }
.tool-result { margin-top: 15px; padding: 10px; background: white; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.tool-result.hidden { display: none; }
.tool-result strong { display: block; font-size: 1.4rem; color: #333; }
.status-badge-mini { display: inline-block; padding: 4px 12px; border-radius: 20px; background: #eee; font-size: 0.8rem; font-weight: 700; margin-top: 5px; }

/* Settings Modal */
.modal-content-settings { background: white; width: 90%; max-width: 900px; height: 80vh; border-radius: 15px; display: flex; flex-direction: column; overflow: hidden; animation: scaleUp 0.3s ease; }
.modal-header-settings { padding: 15px 20px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; }
.settings-layout { display: flex; flex: 1; }
.settings-sidebar { width: 280px; background-color: #f7f9f9; border-right: 1px solid var(--border-light); padding: 10px 0; }
.settings-nav-btn { display: block; width: 100%; background: none; border: none; padding: 15px 20px; font-size: 0.95rem; color: #333; font-weight: 600; cursor: pointer; text-align: left; }
.settings-nav-btn.active { background-color: white; border-left: 3px solid var(--primary-color); }
.settings-content-area { flex: 1; padding: 0; overflow-y: auto; }
.settings-section { display: none; padding: 25px 30px; }
.settings-section.active { display: block; }
.st-form-group { margin-bottom: 20px; }
.st-form-group label { display: block; font-size: 0.85rem; color: #536471; margin-bottom: 5px; font-weight: 700; }
.st-form-group input { width: 100%; padding: 12px; border: 1px solid #cfd9de; border-radius: 5px; }
.btn-icon-close { width: 32px; height: 32px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #666; }
@keyframes scaleUp { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* Search Dropdown */
.search-dropdown { position: absolute; top: 100%; left: 0; width: 100%; background: white; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); border: 1px solid var(--border-light); margin-top: 8px; max-height: 400px; overflow-y: auto; z-index: 1000; padding: 10px 0; }
.search-dropdown.hidden { display: none; }
.search-item { padding: 12px 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: background 0.2s; border-bottom: 1px solid #f5f5f5; text-decoration: none; color: inherit; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background-color: #f0f2f5; }

/* UX: campo da sidebar abre drawer de busca */
.sidebar-search input,
.mobile-menu-search input {
    cursor: pointer;
}

/* RESPONSIVIDADE */
@media (max-width: 992px) {
    .right-sidebar { display: none; }
    .main-layout { grid-template-columns: 80px 1fr; }
    .brand-text, .nav-links span, .profile-info-mini { display: none; }
    .sidebar { width: 80px; align-items: center; padding: 20px 10px; }
    .logo-area { justify-content: center; padding: 0; width: 100%; }
    .nav-links a { justify-content: center; padding: 15px; }
}
@media (max-width: 700px) {
    .sidebar { display: none; }
    .right-sidebar { display: none; }
    .mobile-header { display: flex; }
    .bottom-nav { display: flex; }
    .main-layout { flex-direction: column; padding-top: 66px; }
    .content-area { padding: 20px 15px; padding-bottom: 100px; }
}