/* ========================================
   SIDEBAR COLAPSÁVEL MODERNO
   Estados: colapsado (70px) e expandido (250px)
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 70px;
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    box-shadow: 2px 0 15px var(--shadow-medium);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    overflow: visible;
}

.sidebar.expanded {
    width: 250px;
}

/* Logo/Header */
.sidebar-header {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    height: 70px;
    overflow: visible;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s;
}

.sidebar-logo:hover {
    opacity: 0.85;
}

.sidebar-logo:hover .sidebar-logo-icon {
    transform: scale(1.05);
}

.sidebar-logo-icon {
    background: transparent;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.expanded .sidebar-logo-icon {
    border-radius: 8px;
    width: auto;
    max-width: 200px;
    padding: 8px 6px;
    justify-content: flex-start;
}

.sidebar-logo-icon i {
    color: var(--chrome-text-hover);
    font-size: 1.5rem;
}

/* Logo da sidebar */
.sidebar-logo-image {
    width: 45px;
    height: 45px;
    object-fit: contain;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* Texto VOX Agri ao lado do logo */
.sidebar-logo-text {
    display: none;
    align-items: baseline;
    margin-left: 5px;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.expanded .sidebar-logo-text {
    display: flex;
    opacity: 1;
    max-width: 150px;
    transition: opacity 0.3s ease, max-width 0.3s ease;
}

.sidebar-logo-vox {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--chrome-text);
    letter-spacing: 0.5px;
    transform: scaleY(1.1);
}

.sidebar-logo-agri {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--chrome-text-muted);
    margin-left: 4px;
    transform: scaleY(1.1);
}

.sidebar-logo-text-inside {
    color: var(--primary-green);
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 0;
    overflow: hidden;
    line-height: 1;
    align-self: flex-end;
    margin-bottom: 2px;
}

.sidebar.expanded .sidebar-logo-text-inside {
    opacity: 1;
    max-width: 120px;
}

.sidebar.expanded .sidebar-logo-text {
    opacity: 1;
    max-width: 200px;
}

/* Scrollable content */
.sidebar-content {
    height: calc(100vh - 70px - 85px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Seções Colapsáveis */
.sidebar-section {
    margin: 4px 0;
}

.sidebar-section-header {
    padding: 12px 16px;
    margin: 0 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 4px 0 0 4px;
    transition: all 0.2s;
    user-select: none;
    position: relative;
    border-left: 5px solid rgba(243, 156, 18, 0.5);
}

/* Header compacto no modo colapsado */
.sidebar:not(.expanded) .sidebar-section-header {
    padding: 8px 4px;
    margin: 2px 8px;
    justify-content: center;
}

.sidebar-section-header:hover {
    background: rgba(243, 156, 18, 0.3);
}

.sidebar-section-title {
    color: var(--chrome-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    flex: 1;
}

.sidebar.expanded .sidebar-section-title {
    opacity: 1;
}

/* Iniciais dos grupos — visíveis apenas no modo colapsado */
.sidebar-section-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--chrome-text-muted);
    padding: 2px 0;
    transition: opacity 0.3s, width 0.3s;
}

.sidebar.expanded .sidebar-section-initials {
    opacity: 0;
    width: 0;
    overflow: hidden;
    padding: 0;
}

/* Tooltip para iniciais no modo colapsado */
.sidebar:not(.expanded) .sidebar-section-header[data-tooltip-collapsed]:hover::after {
    content: attr(data-tooltip-collapsed);
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg-start);
    color: var(--chrome-text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 4px 12px var(--shadow-heavy);
    z-index: 1000;
    pointer-events: none;
}

/* No colapsado, esconde título e chevron — mostra só iniciais */
.sidebar:not(.expanded) .sidebar-section-title {
    display: none;
}

.sidebar:not(.expanded) .sidebar-section-icon {
    display: none;
}

.sidebar-section-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
}

.sidebar.expanded .sidebar-section-icon {
    opacity: 0.7;
}

.sidebar-section-icon i {
    font-size: 0.75rem;
    color: var(--chrome-text-muted);
    transition: transform 0.3s;
}

.sidebar-section.collapsed .sidebar-section-icon i {
    transform: rotate(-90deg);
}

.sidebar-section-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.sidebar-section.collapsed .sidebar-section-content {
    max-height: 0;
    opacity: 0;
}

/* Menu items */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 2px 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--chrome-text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.sidebar-menu a:hover {
    background: rgba(243, 156, 18, 0.3);
    color: var(--chrome-text-hover);
}

.sidebar-menu a.active {
    background: #f39c12;
    color: var(--chrome-text-hover);
}

.sidebar-menu a i {
    width: 22px;
    min-width: 22px;
    text-align: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.sidebar-menu a span {
    margin-left: 16px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar.expanded .sidebar-menu a span {
    opacity: 1;
}

/* Tooltip para modo colapsado - apenas para elementos com data-tooltip */
.sidebar:not(.expanded) .sidebar-menu a[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-bg-start);
    color: var(--chrome-text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 4px 12px var(--shadow-heavy);
    z-index: 1000;
    pointer-events: none;
}

/* Footer do sidebar */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 85px;
    overflow: hidden;
}

.sidebar-footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar.expanded .sidebar-footer-content {
    opacity: 1;
}

.sidebar-footer-label {
    color: var(--chrome-text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-footer-value {
    color: #f39c12;
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 2px;
}

.sidebar-footer-logo-box {
    background: transparent;
    border-radius: 4px;
    padding: 0;
    margin-top: 5px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.sidebar-footer-logo-box:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.sidebar-footer-logo {
    max-width: 100%;
    max-height: 45px;
    height: auto;
    display: block;
}

.sidebar.expanded .sidebar-footer-logo {
    max-height: 40px;
}

/* Botão de toggle na navbar */
.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--chrome-text);
    cursor: pointer;
    padding: 8px 12px;
    margin-right: 15px;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: rgba(243, 156, 18, 0.3);
}

.sidebar-toggle i {
    font-size: 1.3rem;
    transition: transform 0.3s;
}

/* Quick nav links na navbar */
.navbar-quick-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}
.navbar-quick-link,
.navbar-quick-link:link,
.navbar-quick-link:visited {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: var(--chrome-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.navbar-quick-link:hover {
    background: rgba(243, 156, 18, 0.3);
    color: var(--chrome-text-hover);
    text-decoration: none;
}
.navbar-quick-link.active,
.navbar-quick-link.active:link,
.navbar-quick-link.active:visited {
    background: #f39c12;
    color: var(--chrome-text-hover);
}
.navbar-quick-link i {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* --------------- Focus Indicators para superfícies escuras --------------- */
.sidebar-menu a:focus-visible,
.sidebar-section-header:focus-visible,
.sidebar-toggle:focus-visible,
.navbar-quick-link:focus-visible,
.org-switcher-pill:focus-visible,
.user-menu-trigger:focus-visible,
.btn-notifications:focus-visible {
    outline: 2px solid #f39c12;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(243, 156, 18, 0.3);
}

/* ========================================
   MOBILE: sidebar off-screen por padrão
   ======================================== */
@media (max-width: 991px) {
    .sidebar,
    .sidebar.expanded {
        left: 0 !important;
        width: 250px !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        overflow: visible;
    }

    .sidebar.mobile-open .sidebar-logo-text,
    .sidebar.mobile-open .sidebar-section-title,
    .sidebar.mobile-open .sidebar-menu a span,
    .sidebar.mobile-open .sidebar-footer-content {
        opacity: 1;
    }

    /* Tooltips desabilitados no mobile — evita overflow fora da sidebar */
    .sidebar .sidebar-menu a[data-tooltip]:hover::after,
    .sidebar .sidebar-section-header[data-tooltip-collapsed]:hover::after {
        display: none;
    }
}

