/* Root Variables */
:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --bg-primary: #f8f9ff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-tertiary: #94a3b8;
        --border: #475569;
        --border-light: #334155;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-primary);
    color: var(--text-primary);
}

body {
    display: flex;
    flex-direction: column;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #f5f5f5;
    color: #2c2c2c;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
    border-right: 1px solid #e0e0e0;
    flex-shrink: 0;
    min-height: 0;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #2c2c2c;
    text-shadow: none;
}

.sidebar-header .subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
    font-weight: 300;
    color: #666666;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.5rem;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: #2c2c2c;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid #e0e0e0;
    background: transparent;
}

.nav-item:hover {
    background: #efefef;
    transform: translateX(4px);
    border-color: #d0d0d0;
    box-shadow: none;
}

.nav-item.active {
    background: #e0e0e0;
    border-color: #808080;
    color: #000;
}

.nav-item .icon {
    font-size: 1.25rem;
}

.nav-item .label {
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #efefef;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid #d0d0d0;
}

.user-avatar {
    font-size: 2rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
    color: #2c2c2c;
}

.user-role {
    font-size: 0.8rem;
    opacity: 0.7;
    margin: 0.25rem 0 0 0;
    color: #666666;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    max-height: 100%;
    position: relative;
    z-index: 100;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f5f5f5 !important;
    color: #2c2c2c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 500;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    min-height: 60px;
    position: relative;
    width: 100%;
    visibility: visible;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #2c2c2c;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: #2c2c2c;
}

.header-right {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    color: #2c2c2c;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #e0e0e0;
    border-color: #b0b0b0;
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-primary);
    min-height: 0;
    max-height: 100%;
}

/* Responsive - Tablet and Below */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-out;
        display: flex;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .app-container {
        position: relative;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-out;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }

    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .page-title {
        font-size: 1.2rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}
