:root {
    --header-height: 60px;
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 70px;
    --transition-speed: 0.3s;
    --bg-dark: #0c0b13;
    --bg-elevated: #1a1a27;
    --text-primary: #f5f5f5;
    --text-secondary: rgba(245, 245, 245, 0.7);
    --accent-primary: #8541d4;
    --accent-secondary: #6a35b0;
    --bg-gradient-start: #1a1325;
    --bg-gradient-end: #2a1f3d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    position: relative;
}

/* Enhanced background with sophisticated patterns */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 35%, rgba(255, 182, 255, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(147, 86, 220, 0.05) 0%, transparent 55%),
        radial-gradient(circle at 50% 70%, rgba(186, 104, 200, 0.04) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* Core Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: transparent;
    position: relative;
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, rgba(68, 5, 58, 0.95) 0%, rgb(3, 2, 43) 100%);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content {
    flex: 1;
    padding: 1.5rem;
    min-height: calc(100vh - var(--header-height));
}

body[data-sidebar="collapsed"] .main-content {
    margin-left: var(--sidebar-width-collapsed);
    width: calc(100% - var(--sidebar-width-collapsed));
}

/* Sidebar States */
.sidebar {
    z-index: 1000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content {
        padding: 1rem;
    }

    body[data-sidebar="collapsed"] .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    body.sidebar-visible {
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
    }

    .sidebar-backdrop {
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }
}

/* iOS height fix */
@supports (-webkit-touch-callout: none) {
    .main-content,
    .content {
        min-height: -webkit-fill-available;
    }
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(31, 41, 55, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, rgba(133, 65, 212, 0.7), rgba(69, 39, 160, 0.7));
    border-radius: 10px;
}

/* Touch-friendly adjustments */
@media (hover: none) {
    .clickable, 
    button,
    .user-profile,
    .nav-link {
        -webkit-tap-highlight-color: transparent;
    }
    
    input, 
    select, 
    textarea {
        font-size: 16px !important;
    }
}

/* Fix for iOS height issues */
@supports (-webkit-touch-callout: none) {
    .main-content {
        height: -webkit-fill-available;
    }
    
    .content {
        height: calc(100vh - var(--header-height));
        height: calc((var(--vh, 1vh) * 100) - var(--header-height));
    }
}

.header {
    z-index: 100;
}