@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #07090e;
    --bg-surface: #0d1117;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.15);
    --text-main: #e6edf3;
    --text-dim: #7d8590;
    --border: rgba(255, 255, 255, 0.08);
    --success: #238636;
    --danger: #da3633;
    --sidebar-width: 280px;
    --tree-border: rgba(255, 255, 255, 0.1);
    --tree-hover: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    /* Flex for sidebar and content */
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Sidebar Layout */
aside {
    width: var(--sidebar-width);
    height: 100vh;
    border-right: 1px solid var(--border);
    background: var(--bg-dark);
    position: fixed;
    left: 0;
    top: 0;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: center;
}

main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
}

.sidebar-logo {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    padding-left: 1rem;
    color: var(--accent);
}

/* Tree Navigation Styles */
.tree-container {
    width: 100%;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

ul ul {
    margin-left: 20px;
    padding-left: 0;
    border-left: none;
}

ul ul .tree-item {
    margin: 0;
}

.tree-label,
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
    transition: background-color 0.2s;
    user-select: none;
    height: 38px;
}

.nav-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
    /* Makes black icons white */
}

.nav-icon.no-filter {
    filter: none !important;
}

.tree-label:hover,
.file-item:hover {
    background-color: var(--tree-hover);
}

.is-selected {
    background-color: var(--tree-hover);
    color: var(--accent);
    font-weight: 600;
}

.tree-toggle {
    display: none;
}

.tree-children-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease-in-out;
}

.tree-children {
    overflow: hidden;
}

.tree-toggle:checked~.tree-children-wrapper {
    grid-template-rows: 1fr;
}

/* Content Styles */
.container {
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: left;
    color: var(--text-main);
    padding-left: 1rem;
    border-left: 3px solid var(--accent);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.stats-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    /* Slightly thicker header line */
}

.stats-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    border-left: none;
    border-right: none;
}

.stats-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 1px solid var(--border);
}

.user-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
}

.user-id {
    font-size: 0.7rem;
    color: var(--text-dim);
    display: block;
    margin-top: 1px;
}

.stat-value {
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.currency-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
}

/* Roles Styles */
.roles-list {
    display: flex;
    flex-direction: column;
}

.role-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
}

.role-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.role-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.badge-citizen {
    background: rgba(35, 134, 54, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge-mafia {
    background: rgba(218, 54, 51, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.role-desc {
    color: var(--text-dim);
    font-size: 0.85rem;
    max-width: 600px;
}

/* Functions Styles */
.functions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.function-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.function-item:hover {
    border-color: var(--accent);
}

.function-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
}

.function-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.function-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
}

.function-price {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 10px;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.1);
}

.function-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.function-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.function-section strong {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
}

.function-desc,
.function-usage {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-main);
}

.header-with-search {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0 0.5rem;
    border-left: 3px solid var(--accent);
}

.header-with-search h1 {
    margin-bottom: 0;
    border-left: none;
    padding-left: 0;
}

.search-input {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    outline: none;
    transition: all 0.2s;
    width: 180px;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    aside {
        width: 100%;
        height: auto;
        position: fixed;
        /* Changed from relative to fixed */
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        transform: translateX(-100%);
        /* Added */
        height: 100vh;
        /* Added */
        width: var(--sidebar-width);
        /* Added */
    }

    aside.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
    }

    .menu-toggle.open {
        left: calc(var(--sidebar-width) - 45px);
        color: var(--accent);
    }

    .sidebar-overlay.open {
        display: block;
    }

    main {
        margin-left: 0;
        width: 100%;
        padding: 4rem 1rem 1rem 1rem;
        /* Modified */
    }

    .sidebar-logo {
        margin-bottom: 1.5rem;
        padding-left: 1rem;
        font-size: 1.1rem;
    }

    .header-with-search {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        width: 100%;
    }
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 12px;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.stat-card .stat-label {
    display: block;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card .stat-count {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.shortcut-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
    font-weight: 500;
    color: var(--text-dim);
}

.shortcut-card:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

footer {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
    /* Push to bottom of sidebar */
}