:root {
    --primary: #6366f1;
    --primary-alt: #4f46e5;
    --bg-main: #0b0f1a;
    --bg-side: #111827;
    --bg-top: rgba(17, 24, 39, 0.8);
    --border: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-dim: #9ca3af;
    --glass: rgba(255, 255, 255, 0.03);
    --card-bg: #1f2937;
    --radius-lg: 16px;
    --radius-md: 12px;
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    /* Main app is full screen */
    height: 100vh;
}

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

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo .icon {
    font-size: 1.5rem;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 1rem;
}

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

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.sidebar-footer {
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-alt));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#user-name {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05), transparent);
}

.top-bar {
    height: 80px;
    min-height: 80px;
    background: var(--bg-top);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 48px;
}

#view-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Content Area */
.content-body {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.view {
    animation: fadeIn 0.4s ease-out;
}

/* UI Components */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-alt);
}

.full-width {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
}

.input-group {
    display: flex;
    background: var(--bg-side);
    border: 1px solid var(--border);
    padding: 6px;
    border-radius: var(--radius-md);
    gap: 8px;
    max-width: 600px;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 0 12px;
    outline: none;
}

/* List Components */
.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.lib-item {
    cursor: pointer;
    border: 1px solid var(--border);
}

.lib-item:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.lib-name {
    font-weight: 600;
    font-size: 1.05rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.05);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.welcome-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 40px;
    border-radius: var(--radius-lg);
}

.welcome-banner h3 {
    margin-bottom: 12px;
    font-family: 'Outfit';
}

/* Permissions & Modal */
.permission-entry {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: background 0.2s;
}

.permission-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.group-owners {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.owner-pill {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-weight: 500;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content.glass {
    width: 90%;
    max-width: 850px;
    max-height: 85vh;
    padding: 3.5rem 3rem 3rem 3rem;
    border-radius: 28px;
    position: relative;
    overflow-y: auto;
    background: #111827;
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 2.5rem;
    font-size: 2.5rem;
    cursor: pointer;
    color: var(--text-dim);
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: white;
}

/* Helpers */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}