:root {
    --primary: #2F855A;
    --secondary: #2B6CB0;
    --bg: #0B1220;
    --surface: #111A2E;
    --text: #E6EEF7;
    --text-muted: #A0AEC0;
    --danger: #E53E3E;
    --success: #38A169;
    --radius: 16px;
}

/* Layout & Sidebar */
.layout { display: flex; min-height: 100vh; transition: all 0.3s ease; }
.sidebar { 
    width: 250px; 
    background: var(--surface); 
    padding: 1rem; 
    display: flex; 
    flex-direction: column; 
    transition: width 0.3s ease; 
    flex-shrink: 0;
}
.content { 
    flex: 1; 
    padding: 2rem; 
    overflow-y: auto; 
    transition: margin-left 0.3s ease; 
}

/* Collapsed Desktop */
.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .menu-text, 
.sidebar.collapsed .group-selector,
.sidebar.collapsed h2 span { display: none; }
.sidebar.collapsed .menu-item { text-align: center; padding: 15px 5px; }
.sidebar.collapsed .menu-item i { font-size: 1.5em; margin: 0; }
.sidebar.collapsed h2 { 
    justify-content: center; 
    padding: 0;
    height: 40px;
}
.sidebar.collapsed h2 .header-btn {
    margin: 0;
    position: relative;
    z-index: 100;
}

/* Mobile */
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { 
        position: fixed; 
        top: 0; 
        left: -260px; 
        height: 100vh; 
        z-index: 2000; /* Higher than top-bar */
        width: 250px;
        transition: left 0.3s ease;
    }
    .sidebar.active { left: 0; }
    .top-bar { 
        display: flex !important; 
        z-index: 1000;
        position: sticky;
        top: 0;
    }
    
    /* Overlay when sidebar active */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0; left: 0; width: 100vw; height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: -1;
    }
}

@media (min-width: 769px) {
    .top-bar { display: none; }
}

.menu-item.active {
    background: rgba(255,255,255,0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.top-bar {
    display: none;
    padding: 1rem;
    background: var(--surface);
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-radius: var(--radius);
}

/* Header Buttons */
.header-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: var(--text);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex; align-items: center; justify-content: center;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
}

/* Toast System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    color: var(--text);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border-left: 5px solid var(--primary);
    min-width: 250px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: #D69E2E; }
.toast.info { border-left-color: var(--secondary); }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2em;
    margin-left: 15px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.hiding {
    opacity: 0;
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    display: none; /* Hidden by default */
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
