/* Sidebar Layout Styles */

:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 70px;
    --primary-green: #1E8449;
    --primary-green-dark: #16A085;
    --text-dark: #2C3E50;
    --bg-light: #F8F9FA;
    --border-color: #E9ECEF;
    --sidebar-bg: #1a1d29;
    --sidebar-text: #9ba3b6;
    --sidebar-text-active: #ffffff;
    --sidebar-hover: #252936;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .user-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-user {
    padding: 1rem;
    justify-content: center;
}

.sidebar.collapsed .user-avatar {
    margin-right: 0;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.brand-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--sidebar-hover);
    color: white;
}

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.125rem;
    margin-right: 1rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.user-info {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    color: var(--sidebar-text);
    font-size: 0.875rem;
    margin-top: 0.125rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9375rem;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    transform: translateX(3px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 132, 73, 0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: white;
    border-radius: 0 4px 4px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    color: #e74c3c;
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Bar */
.top-bar {
    background: white;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 0.5rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-user {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.9375rem;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 1.5rem;
    background: var(--bg-light);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Footer */
.app-footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.footer-content {
    text-align: center;
    color: #6c757d;
    font-size: 0.875rem;
}

/* Sidebar Overlay - Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.collapsed~.main-content {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .top-bar {
        padding: 0 1rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .content-area {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 1.125rem;
    }

    .top-bar-user {
        display: none;
    }

    .content-area {
        padding: 1rem 0.75rem;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-area>* {
    animation: slideIn 0.4s ease-out;
}

/* ========== UTILITIES ========== */
.card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========== MOBILE MENU BUTTON ========== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 500;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--sidebar-bg);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--primary-green);
    transform: scale(1.05);
}

@media (max-width: 992px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}