:root {
    --primary: #5865F2;
    --primary-hover: #4752c4;
    --background: #36393f;
    --secondary-bg: #2f3136;
    --tertiary-bg: #202225;
    --text-primary: #ffffff;
    --text-secondary: #b9bbbe;
    --success: #3ba55c;
    --danger: #ed4245;
    --warning: #faa61a;
    --border-radius: 8px;
    --sidebar-width: 240px;
    --topbar-height: 60px;
}

/* Light theme overrides (toggled via documentElement[data-theme="light"]) */
:root[data-theme="light"] {
    --background: #f5f5f5;
    --secondary-bg: #ffffff;
    --tertiary-bg: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
}

.app {
    display: flex;
    min-height: 100vh;
}

.app.blurred {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.nav-section {
    margin: 10px 0;
    padding: 0 10px;
}

.nav-header {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 10px 16px;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 4px;
    margin: 2px 0;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.nav-item:hover {
    background-color: rgba(79, 84, 92, 0.32);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(114, 137, 218, 0.1);
    color: var(--text-primary);
}

.nav-item i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.user-panel {
    margin-top: auto;
    padding: 16px;
    background-color: var(--tertiary-bg);
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}

.logout-btn:hover {
    background-color: rgba(79, 84, 92, 0.32);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: var(--topbar-height);
    background-color: var(--secondary-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--tertiary-bg);
    border-radius: 4px;
    padding: 0 10px;
    width: 300px;
}

.search-bar i {
    color: var(--text-secondary);
    margin-right: 8px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 0;
    width: 100%;
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
}

.notification-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    position: relative;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    border-radius: 4px;
}

.notification-btn:hover {
    background-color: rgba(79, 84, 92, 0.32);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.stat-icon i {
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Console */
.console-container {
    background-color: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #333;
}

.console-header {
    padding: 10px 16px;
    background: linear-gradient(to right, #2a2a2a, #1e1e1e);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #0c0c0c;
    position: relative;
}

.console-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #5865F2, #3BA55C, #FAA61A, #ED4245);
}

.console-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.console-header h3::before {
    content: '❯';
    color: #5865F2;
    font-size: 1.1em;
}

.console-actions {
    display: flex;
    gap: 8px;
}

.console-body {
    padding: 0;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    background-color: #1e1e1e;
    color: #f0f0f0;
    height: 400px;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#console-output {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
    scrollbar-color: #4f4f4f #2a2a2a;
}

#console-output::-webkit-scrollbar {
    width: 8px;
}

#console-output::-webkit-scrollbar-track {
    background: #2a2a2a;
}

#console-output::-webkit-scrollbar-thumb {
    background-color: #4f4f4f;
    border-radius: 4px;
}

.console-input-container {
    padding: 12px 16px;
    background-color: #252526;
    border-top: 1px solid #333;
    position: relative;
}

.console-input {
    display: flex;
    align-items: center;
    background-color: #2d2d2d;
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.console-input:focus-within {
    border-color: #5865F2;
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.prompt {
    color: #9cdcfe;
    margin-right: 10px;
    user-select: none;
    font-weight: bold;
}

#command-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #f0f0f0;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.95rem;
    outline: none;
    caret-color: #5865F2;
}

#command-input::placeholder {
    color: #6b6b6b;
}

/* Console Message Types */
.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
    line-height: 1.5;
    border-left: 2px solid transparent;
    padding-left: 8px;
}

.log-entry .timestamp {
    color: #6b6b6b;
    margin-right: 8px;
    font-size: 0.8em;
    display: inline-block;
    min-width: 80px;
}

.log-entry.command .command {
    color: #9cdcfe;
    font-weight: bold;
}

.log-entry.error {
    color: #f48771;
    border-left-color: #f44336;
}

.log-entry.success {
    color: #b5cea8;
    border-left-color: #4caf50;
}

.log-entry.info {
    color: #9cdcfe;
}

.log-entry.warning {
    color: #ffcc80;
    border-left-color: #ff9800;
}

/* Command Suggestions */
.command-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #333;
}

.suggestion-tag {
    background: rgba(88, 101, 242, 0.2);
    color: #9cdcfe;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-tag:hover {
    background: rgba(88, 101, 242, 0.4);
}

/* Console Animations */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: #9cdcfe;
    vertical-align: middle;
    margin-left: 2px;
    animation: blink 1s infinite;
}

/* Console Theme Toggle */
.console-theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.console-theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

/* Console Styles */
.console-container {
    background-color: #1e1e1e;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: 'Fira Code', 'Roboto Mono', 'Courier New', monospace;
}

.console-header {
    background-color: #252526;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
}

.console-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #9cdcfe;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.5px;
}

.console-actions {
    display: flex;
    gap: 8px;
}

.console-button {
    background: none;
    border: none;
    color: #9cdcfe;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.console-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.console-output {
    height: 300px;
    overflow-y: auto;
    padding: 16px;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-size: 0.95rem;
    line-height: 1.6;
    font-family: 'Fira Code', 'Roboto Mono', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #2d2d2d;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.timestamp {
    color: #6a9955;
    font-size: 0.8rem;
    margin-right: 8px;
    opacity: 0.8;
}

.command {
    color: #9cdcfe;
    font-weight: 500;
}

.error {
    color: #f48771;
}

.success {
    color: #6a9955;
}

.warning {
    color: #dcdcaa;
}

.info {
    color: #9cdcfe;
}

/* Command Input */
.command-input-container {
    position: relative;
    padding: 12px 16px;
    background-color: #252526;
    border-top: 1px solid #333;
}

.command-input {
    width: 100%;
    padding: 10px 12px;
    background-color: #3c3c3c;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    color: #d4d4d4;
    font-family: 'Fira Code', 'Roboto Mono', monospace;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.command-input:focus {
    outline: none;
    border-color: #4a8bfc;
    box-shadow: 0 0 0 2px rgba(74, 139, 252, 0.2);
}

/* Command Suggestions */
.command-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    background-color: #252526;
    border-top: 1px solid #333;
}

.suggestion-tag {
    background-color: #2a2d2e;
    color: #9cdcfe;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #3c3c3c;
}

.suggestion-tag:hover {
    background-color: #3c3c3c;
    transform: translateY(-1px);
}

/* Scrollbar Styling */
.console-output::-webkit-scrollbar {
    width: 8px;
}

.console-output::-webkit-scrollbar-track {
    background: #252526;
}

.console-output::-webkit-scrollbar-thumb {
    background-color: #3e3e42;
    border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb:hover {
    background-color: #5a5a5a;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .console-output {
        height: 200px;
    }
    
    .log-entry {
        font-size: 0.9rem;
    }
}

/* Apps Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.app-card {
    background: var(--secondary-bg);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.app-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    border-color: rgba(88, 101, 242, 0.4);
}

.app-card-body {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.app-name-wrapper {
    margin-top: auto;
    text-align: center;
    width: 100%;
    margin-bottom: 4px;
}

.app-card-header {
    padding: 0;
    display: flex;
    align-items: center;
    border-bottom: none;
}

.app-icon {
    width: 90%;
    height: 90%;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: bold;
}

.app-icon-roblox {
    background: #ffffff;
}

.app-icon-generic {
    background: linear-gradient(135deg, #4b5563, #6b7280);
}

.app-icon-initial {
    font-weight: 600;
    font-size: 1rem;
}

.app-icon-square {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #ffffff;
    transform: translateY(1px);
}

.app-logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.logo-failed {
    background: #ffffff;
}

.app-card-tile {
    position: relative;
    cursor: pointer;
    aspect-ratio: 1 / 1;
}

.app-subtitle {
    font-size: 0.8rem;
}

.app-info h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.app-info p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.app-actions {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.1);
}

.no-apps {
    text-align: center;
    padding: 40px 20px;
    grid-column: 1 / -1;
    color: var(--text-secondary);
}

.no-apps i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-apps p {
    margin: 10px 0 20px;
    font-size: 1rem;
}

/* Settings page tweaks */
.settings-grid {
    grid-template-columns: minmax(0, 520px);
    max-width: 640px;
}

.settings-card-header {
    align-items: center;
    gap: 12px;
}

.settings-icon {
    background: linear-gradient(135deg, #5865F2, #7c5cff);
}

.settings-current {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-body {
    padding: 14px 20px 16px;
    background: rgba(0, 0, 0, 0.08);
}

.settings-toggle-group {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-toggle {
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
}

.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Documentation Page */
.docs-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    margin-top: 16px;
}

.docs-sidebar {
    background: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 16px 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.docs-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.docs-link {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.docs-link:hover {
    background: rgba(88, 101, 242, 0.18);
    color: var(--text-primary);
    transform: translateX(2px);
}

.docs-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.docs-block {
    background: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.docs-block h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.docs-block h2 i {
    color: var(--primary);
}

.docs-block h3 {
    font-size: 0.95rem;
    margin-top: 12px;
    margin-bottom: 6px;
}

.docs-block p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.docs-block ul {
    margin-left: 18px;
    margin-bottom: 8px;
}

.docs-block li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.docs-block pre {
    margin: 8px 0 10px;
    padding: 10px 12px;
    background: #202225;
    border-radius: 6px;
    border: 1px solid #2f3136;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
}

.docs-block code {
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    background: rgba(32, 34, 37, 0.9);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .docs-grid {
        grid-template-columns: 1fr;
    }

    .docs-sidebar {
        order: -1;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .docs-section-title {
        width: 100%;
        margin-bottom: 4px;
    }

    .docs-link {
        padding: 6px 10px;
    }
}

/* Login Modal */
.modal {
    /* Hidden by default; JS (showLogin) will set display to 'flex' when needed */
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-container {
    padding: 30px;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--tertiary-bg);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        overflow: hidden;
    }
    
    .sidebar-header h2,
    .nav-item span,
    .user-info,
    .nav-header {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 12px 0;
    }
    
    .nav-item i {
        margin-right: 0;
        font-size: 1.2rem;
    }
    
    .user-panel {
        justify-content: center;
        padding: 10px;
    }
    
    .user-avatar {
        margin-right: 0;
    }
    
    .user-avatar img {
        width: 32px;
        height: 32px;
    }
    
    .search-bar {
        width: 200px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #4f545c;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5d6269;
}
