:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-hover: #1a1a1a;
    --border: #2a2a2a;
    --text: #e5e5e5;
    --text-muted: #808080;
    --accent: #9b59b6;
    --success: #46d369;
    --warning: #f5c518;
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.role-badge {
    background: rgba(155, 89, 182, 0.2);
    /* Purple tint */
    background: color-mix(in srgb, var(--accent), transparent 80%);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--surface-hover);
}

.btn-change-password {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-change-password:hover {
    background: color-mix(in srgb, var(--accent), transparent 85%);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 0;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    color: var(--text-muted);
}

.nav-links li:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-links li.active {
    background: rgba(155, 89, 182, 0.1);
    /* fallback/tint of accent */
    background: color-mix(in srgb, var(--accent), transparent 90%);
    border-left-color: var(--accent);
    color: var(--text);
}

.nav-links li i {
    margin-right: 10px;
    width: 20px;
}

/* Content Area */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Cards (formerly Glass) */
.glass {
    background: rgba(20, 20, 20, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.glass h2 {
    margin-bottom: 20px;
    font-size: 20px;
    color: var(--text);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
}

/* Status */
.status-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.status-item {
    padding: 15px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.status-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.status-value {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: gray;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: none;
    box-shadow: none;
}

.btn-success {
    background: var(--accent);
    /* Changed from success green to accent purple */
    color: white;
}

.btn-success:hover {
    opacity: 0.9;
    transform: none;
    box-shadow: none;
}

.btn-danger {
    background: var(--accent);
    /* Reusing accent for danger as it's red */
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}


.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sm:hover {
    background: var(--surface-hover);
}

.btn-group {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 6px 10px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--border);
    color: var(--accent);
}

.action-btn.danger {
    color: var(--accent);
    border-color: var(--accent);
    background: transparent;
}

.action-btn.danger:hover {
    background: var(--accent);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg);
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-row label {
    color: var(--text);
}

.toggle-row input[type="checkbox"] {
    width: 40px;
    height: 20px;
    accent-color: var(--accent);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--surface-hover);
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

tr:hover {
    background: var(--surface-hover);
}

/* Logs */
.log-container {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    color: var(--text);
}

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border: 2px solid var(--bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header {
        padding: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-left {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        background: rgba(10, 10, 20, 0.95);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        transition: left 0.3s ease;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0;
    }

    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
        backdrop-filter: blur(2px);
    }

    .overlay.active {
        display: block;
    }

    .menu-toggle {
        display: block;
        font-size: 24px;
        color: white;
        background: none;
        border: none;
        cursor: pointer;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 10px;
    }

    .status-row {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 15px;
    }
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
}