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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-header-gradient);
    min-height: 100vh;
}

.admin-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--bg-container);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow-color);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    color: var(--text-main);
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: var(--input-bg);
    color: var(--text-main);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn-login,
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--bg-header-gradient);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: var(--bg-tab);
    color: var(--text-main);
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-tab-hover);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.power-status {
    margin: 20px 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.status-online { background-color: #28a745; color: #fff; }
.status-offline { background-color: #dc3545; color: #fff; }
.status-starting { background-color: #ffc107; color: #000; }

.power-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-success { background-color: #28a745; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }
.btn-warning { background-color: #ffc107; color: black; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }

.btn-success:hover { background-color: #218838; }
.btn-warning:hover { background-color: #e0a800; }
.btn-success:disabled, .btn-danger:disabled, .btn-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dashboard-container {
    background: var(--bg-container);
    min-height: 100vh;
}

.admin-navbar {
    background: var(--bg-header-gradient);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.navbar-brand h2 {
    font-size: 20px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dashboard-content {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 250px;
    background: var(--bg-tab);
    padding: 30px 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    border-right: 1px solid var(--border-color);
}

.nav-menu {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 15px 30px;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-tab-hover);
    border-left: 4px solid var(--accent-color);
    color: var(--accent-color);
}

.main-content {
    flex: 1;
    padding: 30px;
    background: var(--bg-container);
}

.content-section {
    display: none;
}

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

.content-section h2 {
    color: var(--text-main);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: var(--bg-header-gradient);
    color: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px var(--shadow-color);
}

.stat-card h3 {
    font-size: 14px;
    margin-bottom: 10px;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: white;
}

.stat-status {
    font-size: 18px;
    font-weight: 600;
}

.user-actions {
    margin-bottom: 20px;
}

.user-form {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.user-form h3 {
    margin-bottom: 20px;
    color: var(--text-main);
}

.permission-builder {
    background: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.permission-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.permission-builder h4 {
    margin: 0;
    color: var(--text-main);
}

.permission-helper {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.permission-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-tab);
}

.permission-group h5 {
    margin-bottom: 8px;
    color: var(--text-main);
}

.permission-bundles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.bundle-toggle {
    background: var(--bg-tab-hover);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
}

.bundle-toggle:hover {
    background: var(--border-color);
}

.permission-list {
    display: grid;
    gap: 6px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-main);
}

.permission-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

.btn-inline {
    width: auto;
    padding: 10px 14px;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.form-actions button {
    flex: 1;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-container);
    box-shadow: 0 2px 10px var(--shadow-color);
    border-radius: 8px;
    overflow: hidden;
}

.user-table thead {
    background: var(--bg-header-gradient);
    color: white;
}

.user-table th,
.user-table td {
    padding: 15px;
    text-align: left;
    color: var(--text-main);
}

.user-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.user-table tbody tr:hover {
    background: var(--bg-tab-hover);
}

.btn-action {
    padding: 6px 12px;
    margin: 0 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: opacity 0.2s;
}

.btn-delete {
    background: #d32f2f;
    color: white;
}

.btn-delete:hover {
    opacity: 0.8;
}

.btn-edit {
    background: #2196f3;
    color: white;
}

.btn-edit:hover {
    opacity: 0.85;
}

.settings-panel {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 10px;
}

.settings-panel h3 {
    color: var(--text-main);
    margin-bottom: 15px;
}

.settings-panel p {
    color: var(--text-muted);
    margin-bottom: 10px;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.role-manager {
    background: #9c27b0;
    color: white;
}

.role-head-staff {
    background: #673ab7;
    color: white;
}

.role-admin {
    background: #f44336;
    color: white;
}

.role-head-admin {
    background: #d32f2f;
    color: white;
}

.role-trial-admin {
    background: #e57373;
    color: white;
}

.role-head-dev {
    background: #2196f3;
    color: white;
}

.role-jr-dev {
    background: #64b5f6;
    color: white;
}

.role-head-builder {
    background: #795548;
    color: white;
}

.role-builder {
    background: #8d6e63;
    color: white;
}

.role-sr-builder {
    background: #6d4c41;
    color: white;
}

.role-jr-builder {
    background: #a1887f;
    color: white;
}

.role-head-moderator {
    background: #ff6f00;
    color: white;
}

.role-moderator {
    background: #ff9800;
    color: white;
}

.role-sr-mod {
    background: #f57c00;
    color: white;
}

.role-helper {
    background: #4caf50;
    color: white;
}

.role-trainee {
    background: #81c784;
    color: white;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.tool-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.tool-card h3 {
    color: var(--text-main);
    margin-bottom: 10px;
}

.tool-card p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Console section styling */
.console-wrapper {
    background: #0b0b10;
    color: #e8e8f5;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.console-header h2 {
    color: #fff;
    margin-bottom: 4px;
    border: none;
}

.console-subtitle {
    color: #9da3c2;
    font-size: 14px;
}

.console-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d32f2f;
    box-shadow: 0 0 0 6px rgba(211, 47, 47, 0.15);
}

.status-dot.live {
    background: #4caf50;
    box-shadow: 0 0 0 6px rgba(76, 175, 80, 0.18);
}

.status-dot.idle {
    background: #fbc02d;
    box-shadow: 0 0 0 6px rgba(251, 192, 45, 0.18);
}

.console-window {
    background: #000;
    color: #e8e8e8;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #1f1f2a;
    height: 320px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
}

.console-line {
    margin-bottom: 6px;
}

.console-input-bar {
    display: flex;
    gap: 10px;
}

.console-input-bar input {
    flex: 1;
    background: #0e0e16;
    color: #e8e8e8;
    border: 1px solid #1f1f2a;
    border-radius: 8px;
    padding: 12px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
}

.console-input-bar input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.console-input-bar .btn-primary {
    width: auto;
    padding: 0 18px;
}

.console-hint {
    color: #9da3c2;
    font-size: 13px;
}

.console-status .btn-secondary {
    width: auto;
    padding: 8px 14px;
    margin-top: 0;
}

.modal-lg {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.inv-container {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.inv-section h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.inv-grid {
    display: grid;
    gap: 4px;
    background: #1a1a1a;
    padding: 8px;
    border-radius: 4px;
    border: 2px solid #333;
}

.armor-grid {
    grid-template-columns: repeat(4, 40px);
}

.offhand-grid {
    grid-template-columns: 40px;
}

.main-grid {
    grid-template-columns: repeat(9, 40px);
}

.inv-slot {
    width: 40px;
    height: 40px;
    background: #333;
    border: 2px solid #444;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 32px;
    image-rendering: pixelated;
}

.inv-slot:hover {
    background-color: #444;
    border-color: #666;
}

.inv-slot[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: pre;
    z-index: 1000;
    pointer-events: none;
    border: 1px solid #555;
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .dashboard-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 15px 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Application Details Modal */
.app-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.detail-item {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.detail-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.85em;
    text-transform: uppercase;
    margin-bottom: 5px;
    font-weight: 600;
}

.detail-value {
    color: var(--text-main);
    font-size: 1em;
    white-space: pre-wrap; /* Preserves newlines in textareas */
}

.modal-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

