:root {
    --bg-color: #0f172a; /* Slate 950 */
    --sidebar-bg: #020617; /* Slate 950 Darker */
    --content-bg: #0f172a;
    --primary-color: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5;
    --accent-color: #ec4899; /* Pink 500 */
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(30, 41, 59, 0.5); /* Slate 800 */
    --card-hover: rgba(30, 41, 59, 0.8);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden; /* Default to hidden, specific pages can override */
}

a {
    text-decoration: none;
    color: inherit;
}

/* Background Glow */
.background-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* Layout Containers */
.app-container, .main-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.logo {
    padding: 20px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    padding: 10px;
    flex: 1;
}

.nav-links li {
    margin-bottom: 4px;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-links a:hover, .nav-links li.active a {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.nav-links li.active a {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.sidebar-footer {
    padding: 20px;
    border-top: var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info .status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    position: relative;
}

.top-header {
    margin-bottom: 40px;
}

.top-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.top-header p {
    color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
    cursor: pointer;
}

.card:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 8px;
}

.card-primary .card-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.card-accent .card-icon {
    background: rgba(236, 72, 153, 0.1);
    color: var(--accent-color);
}

.card-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.card-arrow {
    position: absolute;
    top: 24px;
    right: 24px;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s;
}

.card:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Widgets Section */
.widgets-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.widget {
    background: rgba(15, 23, 42, 0.6);
    border: var(--glass-border);
    border-radius: 12px;
    padding: 20px;
}

.widget h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quote-text {
    font-style: italic;
    font-family: "Georgia", serif;
    font-size: 1.1rem;
    line-height: 1.6;
}

.clock-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
}

/* --- AI Chat Specific Styles (Preserved & Adapted) --- */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--content-bg);
    position: relative;
    max-width: 100%;
}

.chat-header {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.message {
    display: flex;
    gap: 20px;
    padding: 24px 20%;
    width: 100%;
}

.message.ai-message {
    background: transparent;
}

.message.user-message {
    background: transparent;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message .message-avatar { background: #19c37d; color: white; }
.user-message .message-avatar { background: var(--primary-color); color: white; }

.message-content {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--text-color);
}

/* Input Area */
.input-area {
    padding: 20px 20%;
    background-image: linear-gradient(180deg, rgba(15,23,42,0), #0f172a 40%);
}

.input-wrapper {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-end;
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    resize: none;
    padding: 0;
    font-size: 1rem;
    outline: none;
    line-height: 1.5;
}

/* Mobile Responsive */
.mobile-menu-btn, .close-sidebar-btn { display: none; }

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        box-shadow: 10px 0 20px rgba(0,0,0,0.3);
    }
    .sidebar.open { transform: translateX(260px); }
    .mobile-menu-btn {
        display: block;
        position: absolute;
        top: 15px;
        left: 15px;
        background: none;
        border: none;
        color: white;
        font-size: 1.2rem;
        z-index: 50;
    }
    .main-content { padding: 60px 20px 20px 20px; }
    .input-area, .message { padding-left: 15px; padding-right: 15px; }
    .overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); z-index: 90; display: none;
    }
    .overlay.active { display: block; }
}

/* Markdown Styles */
.markdown-body pre {
    background: #1e293b;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
}
.markdown-body code {
    background: rgba(255,255,255,0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Game Modal Styles */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.game-modal.hidden { display: none; }
.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease-out;
}
.modal-content h2 { margin-bottom: 10px; color: #fff; }
.modal-content p { margin-bottom: 20px; color: #cbd5e1; }
.modal-buttons { display: flex; gap: 10px; justify-content: center; }
.game-btn.secondary { background: #334155; }
.game-btn.secondary:hover { background: #475569; }
