/* Sidebar Colapsable */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 60px;
    --sidebar-bg: linear-gradient(180deg, #1a237e 0%, #0d47a1 100%);
    --sidebar-text: #fff;
    --sidebar-hover: rgba(255,255,255,0.1);
    --sidebar-active: rgba(255,255,255,0.2);
    --transition-speed: 0.3s;
}

/* Body adjustment for sidebar */
body.has-sidebar {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed);
}

body.has-sidebar.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* Sidebar container */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed);
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Logo/Brand */
.sidebar-brand {
    padding: 20px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: 70px;
}

.sidebar-brand-icon {
    font-size: 28px;
    min-width: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.1em;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.sidebar.collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
}

/* Toggle button */
.sidebar-toggle {
    position: absolute;
    top: 23px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-speed), transform var(--transition-speed);
    z-index: 10;
    font-size: 18px;
}

.sidebar-toggle .material-icons {
    font-size: 18px;
    transition: transform var(--transition-speed);
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.25);
}

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

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

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

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

.nav-section {
    margin-bottom: 10px;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background var(--transition-speed);
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--sidebar-hover);
}

.nav-item.active {
    background: var(--sidebar-active);
    border-left-color: #fff;
}

.nav-item-icon {
    font-size: 22px;
    min-width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item-text {
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.sidebar.collapsed .nav-item-text {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

/* User section */
.sidebar-user {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    min-width: 36px;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
    transition: opacity var(--transition-speed);
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75em;
    opacity: 0.7;
}

.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
}

.sidebar-logout {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-logout .material-icons {
    font-size: 20px;
}

.sidebar-logout:hover {
    background: rgba(255,255,255,0.25);
}

.sidebar.collapsed .sidebar-logout {
    display: none;
}

/* Tooltip for collapsed state */
.sidebar.collapsed .nav-item {
    position: relative;
}

.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    background: #333;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

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

/* Mobile styles */
@media (max-width: 768px) {
    body.has-sidebar {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
        width: var(--sidebar-width);
    }
    
    .sidebar.mobile-open .sidebar-brand-text,
    .sidebar.mobile-open .nav-item-text,
    .sidebar.mobile-open .sidebar-user-info,
    .sidebar.mobile-open .nav-section-title {
        opacity: 1;
        width: auto;
    }
    
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
}

/* Mobile menu button (hidden by default) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 998;
    background: #1a237e;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.mobile-menu-btn .material-icons {
    font-size: 24px;
}

/* Admin-only items */
.nav-item.admin-only {
    display: none;
}

body.is-admin .nav-item.admin-only {
    display: flex;
}

/* Page header adjustments */
.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    margin-bottom: 20px;
    border-radius: 0 0 15px 15px;
}

.page-header h1 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Content wrapper */
.content-wrapper {
    padding: 20px;
    min-height: calc(100vh - 40px);
}

/* Page title header */
.page-title {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: white;
    padding: 20px 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-title h1,
.page-title h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0;
}

.page-title span {
    font-size: 1.5em;
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 70px 15px 15px 15px;
    }
}
