/* App Layout & Core Structures */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body, button, input, select, textarea {
    font-family: var(--font-family);
}

h1, h2, h3, h4, h5, h6, .section-title, .nav-label {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

body {
    background-color: var(--bg-slate-950);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(37, 99, 235, 0.12), transparent 40vw),
        radial-gradient(circle at 85% 30%, rgba(147, 51, 234, 0.12), transparent 40vw);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

aside.sidebar {
    width: var(--sidebar-width);
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

/* Custom scrollbar for sidebar */
aside.sidebar::-webkit-scrollbar {
    width: 4px;
}
aside.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
aside.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
aside.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    margin-bottom: 28px;
    flex-shrink: 0;
}

.sidebar-logo i {
    font-size: 1.8rem;
    color: var(--primary-blue);
}

.sidebar-logo span {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.nav-group {
    margin-bottom: 8px;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 8px 12px;
    margin-bottom: 4px;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    user-select: none;
}

.nav-label:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-label-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-label .platform-icon {
    font-size: 0.85rem;
    width: 18px;
    text-align: center;
}

.nav-collapse-icon {
    font-size: 0.6rem;
    transition: transform 0.3s ease;
    opacity: 0.5;
}

.nav-group.collapsed .nav-collapse-icon {
    transform: rotate(-90deg);
}

.nav-group-items {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group.collapsed .nav-group-items {
    max-height: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item i {
    width: 22px;
    font-size: 1.15rem;
    margin-right: 12px;
    transition: transform 0.3s ease;
}

.nav-item:hover i {
    transform: scale(1.1);
}

main.content-wrapper {
    flex: 1;
    margin-left: 240px;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

header.top-header {
    height: var(--header-height);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.header-status {
    display: flex;
    gap: 16px;
}

.status-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-red);
}

.dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--bg-slate-800);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.section-container {
    padding: 24px;
    display: none;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-container.active {
    display: block;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Sidebar Collapsed */
aside.sidebar { width: 240px; transition: width 0.3s ease; }
aside.sidebar.collapsed { width: 70px; }
aside.sidebar.collapsed .nav-item span,
aside.sidebar.collapsed .nav-label span,
aside.sidebar.collapsed .sidebar-logo span,
aside.sidebar.collapsed .badge { display: none; }
aside.sidebar.collapsed .sidebar-logo { text-align: center; margin-left: 0; justify-content: center; }
aside.sidebar.collapsed .nav-label { justify-content: center; padding: 10px 0; }
aside.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
aside.sidebar.collapsed .nav-item i { margin-right: 0; }
main.content-wrapper { transition: margin-left 0.3s ease; margin-left: 240px; }
main.content-wrapper.expanded { margin-left: 70px; }
