/* =========================================================
   SIDEBAR.CSS - Sistema de Sidebars (Esquerda e Direita)
   Projeto: MPPE Caatinga Resiste 2026
========================================================= */

/* =========================================================
   1. SIDEBAR ESQUERDA (NAVEGAÇÃO)
========================================================= */

.sidebar-left {
    width: var(--sidebar-width);
    background: var(--color-primary-dark);
    color: var(--text-light);
    height: var(--sidebar-height);
    position: fixed;
    left: clamp(5px, 1vw, 10px);
    top: clamp(14vh, 17vh, 20vh);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-sidebar);
    overflow-y: hidden;
    overflow-x: visible;
    transition: all var(--transition-slow);
}

/* Lista de itens */
.sidebar-list {
    padding: var(--spacing-lg) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-list:last-child {
    border-bottom: none;
}

.sidebar-label {
    padding: 0 var(--spacing-sm) var(--spacing-sm);
    text-transform: uppercase;
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item {
    position: relative;
    width: 100%;
}

.sidebar-item > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-light);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: background-color var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item > a:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Itens com quebra de linha */
.sidebar-item.multiline > a {
    white-space: normal;
    line-height: 1.2;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Seta indicadora */
.sidebar-arrow {
    opacity: 0.7;
    transition: transform var(--transition-slow);
    font-size: var(--font-size-xs);
}

.sidebar-item:hover .sidebar-arrow {
    transform: translateX(3px);
    opacity: 1;
}

.sidebar-item.empty {
    height: var(--spacing-lg);
}

/* =========================================================
   2. SUBMENUS (À DIREITA)
========================================================= */

.sidebar-submenu {
    position: fixed;
    left: calc(var(--sidebar-width) + 20px);
    top: clamp(14vh, 17vh, 20vh);
    width: var(--submenu-width);
    height: var(--sidebar-height);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-left: -20px;
    padding-left: 20px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast), left var(--transition-slow);
    z-index: calc(var(--z-sidebar) + 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.sidebar-submenu.active {
    opacity: 1;
    visibility: visible;
}

.submenu-header {
    height: clamp(30px, 4vh, 40px);
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    width: 100%;
    padding: 0 var(--spacing-lg);
    pointer-events: auto;
    box-sizing: border-box;
}

.submenu-title {
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
    margin: 0;
    width: 100%;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.submenu-content {
    flex: 1;
    overflow-y: hidden;
    pointer-events: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    color: var(--text-secondary);
    height: 100%;
    box-sizing: border-box;
}

/* =========================================================
   3. SIDEBAR DIREITA (ANÁLISE)
========================================================= */

.sidebar-right {
    position: fixed;
    top: 50%;
    right: clamp(-35%, -30%, -25%);
    width: var(--sidebar-right-width);
    height: clamp(75%, 82.5%, 85%);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--spacing-md);
    transition: right var(--transition-slow), width var(--transition-slow);
    box-shadow: -3px 0 5px rgba(0, 0, 0, 0.2);
    z-index: var(--z-sidebar-right);
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
}

.sidebar-right.open {
    right: 0;
}

.sidebar-right-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    gap: var(--spacing-sm);
}

.sidebar-right-content h4 {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: var(--spacing-sm);
    flex-shrink: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================================
   4. RESPONSIVIDADE
========================================================= */

@media (max-width: 1400px) {
    .sidebar-left {
        width: clamp(102px, 10.8vw, 132px);
        left: 8px;
    }
    
    .sidebar-submenu {
        left: clamp(126px, 14.4vw, 168px);
        width: clamp(255px, 30.8vw, 305px);
    }
    
    .sidebar-right {
        width: clamp(30%, 35%, 40%);
        right: clamp(-40%, -35%, -30%);
    }
}

@media (max-width: 1200px) {
    .sidebar-left {
        width: clamp(96px, 10.2vw, 120px);
        height: clamp(45.6vh, 59.3vh, 68.4vh);
        top: clamp(17.6vh, 22.8vh, 26.4vh);
    }
    
    .sidebar-submenu {
        left: clamp(114px, 13.2vw, 150px);
        width: clamp(242px, 29.7vw, 286px);
        height: clamp(45.6vh, 59.3vh, 68.4vh);
        top: clamp(17.6vh, 22.8vh, 26.4vh);
    }
    
    .sidebar-right {
        width: clamp(35%, 40%, 45%);
        right: clamp(-45%, -40%, -35%);
    }
}

@media (max-width: 992px) {
    .sidebar-left {
        width: clamp(90px, 9.6vw, 108px);
        height: clamp(42vh, 54vh, 60vh);
        top: clamp(19.2vh, 24vh, 28.8vh);
        left: 5px;
        border-radius: var(--radius-md);
    }
    
    .sidebar-item > a {
        font-size: var(--font-size-xs);
        padding: var(--spacing-xs) 5px;
        flex-direction: column;
        text-align: center;
        gap: 3px;
    }
    
    .sidebar-arrow {
        display: none;
    }
    
    .sidebar-submenu {
        left: clamp(102px, 12vw, 132px);
        width: clamp(220px, 27.5vw, 264px);
        height: clamp(42vh, 54vh, 60vh);
        top: clamp(19.2vh, 24vh, 28.8vh);
        margin-left: -15px;
        padding-left: 15px;
    }
    
    .sidebar-right {
        width: clamp(40%, 50%, 55%);
        right: clamp(-55%, -50%, -40%);
    }
}

@media (max-width: 768px) {
    .sidebar-left {
        width: 84px;
        height: 48vh;
        top: 26vh;
        left: 3px;
        border-radius: var(--radius-md);
    }
    
    .sidebar-submenu {
        left: 94px;
        width: 220px;
        height: 48vh;
        top: 26vh;
        margin-left: -10px;
        padding-left: 10px;
        border-radius: var(--radius-md);
    }
    
    .submenu-header {
        padding: 0 var(--spacing-md);
        height: 35px;
    }
    
    .submenu-title {
        font-size: var(--font-size-base);
    }
    
    .sidebar-right {
        width: clamp(50%, 65%, 70%);
        right: clamp(-70%, -65%, -50%);
        padding: var(--spacing-sm);
    }
}

@media (max-width: 576px) {
    .sidebar-left {
        width: 72px;
        height: 42vh;
        top: 29vh;
        left: 2px;
    }
    
    .sidebar-submenu {
        left: 80px;
        width: 198px;
        height: 42vh;
        top: 29vh;
    }
    
    .submenu-title {
        font-size: var(--font-size-sm);
    }
    
    .sidebar-right {
        width: 85%;
        right: -85%;
        min-width: unset;
    }
}

/* Para telas muito pequenas (notebooks pequenos) */
@media (max-height: 700px) {
    .sidebar-left,
    .sidebar-submenu {
        height: clamp(54vh, 66vh, 78vh);
        top: clamp(14vh, 17vh, 20vh);
    }
}