/* SIDEBAR LAYOUT STYLES - Intranet v3.0 */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #ffffff;
    --sidebar-text: #333333;
    --active-item-bg: rgba(155, 197, 61, 0.15);
    /* Primary Green tint */
    --active-item-border: #9BC53D;
    --hover-bg: #f8f9fa;
}

body {
    display: block;
    /* Robust block layout */
    padding-top: 0 !important;
    min-height: 100vh;
    background: #f0f2f5;
    overflow-x: hidden;
}

/* SIDEBAR CONTAINER */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    border-right: 1px solid #e0e0e0;
    transition: transform 0.3s ease;
}

/* SIDEBAR HEADER (Brand) */
.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #9BC53D, #2AACA2);
    /* Maintain brand colors */
}

.sidebar-header h1 {
    color: white;
    font-size: 1.2rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    margin-top: 5px;
}

/* NAVIGATION LIST */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    list-style: none;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.nav-item {
    margin: 4px 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    gap: 12px;
}

.nav-link i,
.nav-link span.emoji-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-link:hover {
    background-color: var(--hover-bg);
    transform: translateX(3px);
}

.nav-link.active {
    background-color: var(--active-item-bg);
    color: #2AACA2;
    /* Teal */
    font-weight: 600;
}

/* FOOTER (User Profile & Logout) */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
    background: #fcfcfc;
}

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
}

.logout-btn-sidebar {
    width: 100%;
    padding: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.logout-btn-sidebar:hover {
    background: #c0392b;
}

/* MAIN CONTENT ADJUSTMENT */
.main-content {
    margin-left: var(--sidebar-width);
    /* Force simple full width taking up remaining space */
    width: auto;
    flex-grow: 1;
    padding: 2rem;
    box-sizing: border-box;
    /* max-width removed to use full screen space */
}

/* RESPONSIVE TOGGLE (Mobile) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    .mobile-toggle {
        display: block !important;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
        background: #9BC53D;
        color: white;
        border: none;
        padding: 8px 12px;
        border-radius: 5px;
    }
}

/* SIDEBAR COLLAPSE TOGGLE BUTTON */
.sidebar-toggle {
    position: absolute;
    top: 20px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #666;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle .toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-toggle:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

/* COLLAPSED SIDEBAR STATE */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h1,
.sidebar.collapsed .sidebar-header p {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
    font-size: 0;
    /* Hide text */
    overflow: hidden;
}

.sidebar.collapsed .nav-link .emoji-icon {
    font-size: 1.4rem !important;
    /* Show icons */
    margin: 0;
}

.sidebar.collapsed .nav-link:hover .emoji-icon {
    transform: scale(1.2);
}

/* Section headers hidden when collapsed */
.sidebar.collapsed .sidebar-nav>div {
    display: none;
}

/* Tooltip on hover when collapsed */
.sidebar.collapsed .nav-link {
    position: relative;
}

.sidebar.collapsed .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.sidebar.collapsed .nav-link:hover::after {
    opacity: 1;
}

/* Main content adjusts when sidebar collapsed */
.main-content.sidebar-collapsed {
    margin-left: 70px;
}

/* Toggle arrow direction */
.sidebar-toggle .toggle-icon {
    transition: transform 0.3s;
}

.sidebar.collapsed .sidebar-toggle .toggle-icon {
    transform: rotate(180deg);
}