/* Custom Font Imports */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Design Tokens & CSS Variables */
:root {
    --bg-primary: #020203;
    --bg-secondary: #050506;
    --bg-tertiary: #0a0a0c;
    
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.2);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.2);
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.2);
    --accent-rose: #ef4444;
    --accent-rose-glow: rgba(239, 68, 68, 0.2);
    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.2);
    
    --text-primary: #EDEDEF;
    --text-secondary: #8A8F98;
    --text-muted: #6b7280;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(180deg, #0a0a0f 0%, #020203 100%);
    color: var(--text-primary);
    font-family: var(--font-ui);
    display: flex;
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    position: relative;
}

/* Ambient Blobs */
.ambient-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.12;
    animation: blob-oscillation 20s infinite alternate cubic-bezier(0.16, 1, 0.3, 1);
}
.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    top: -100px;
    left: -100px;
}
.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-blue);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
    animation-duration: 25s;
}

@keyframes blob-oscillation {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* App Layout Grid */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 1; /* Above blobs */
}

/* Sidebar Navigation */
aside.sidebar {
    width: 72px; /* Auto-hide / Collapsed by default */
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 10px;
    flex-shrink: 0;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
}

aside.sidebar:hover {
    width: var(--sidebar-width); /* Expands to 260px */
    padding: 24px 16px;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-left: 8px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 0 10px var(--accent-purple-glow);
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    visibility: hidden;
    white-space: nowrap;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

aside.sidebar:hover .brand-name {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.1s;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    white-space: nowrap;
}

aside.sidebar:hover .nav-link {
    padding: 12px 16px;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    transition: stroke 0.2s;
    flex-shrink: 0;
}

.nav-link span {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

aside.sidebar:hover .nav-link span {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.1s;
}

.nav-link:hover, .nav-item.active .nav-link {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.nav-item.active .nav-link {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.2);
    color: #60a5fa;
}

/* User Profile Widget in Sidebar */
.user-profile-widget {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

aside.sidebar:hover .user-profile-widget {
    padding: 16px;
}

/* Removed Collapsed Sidebar Centering Helpers to prevent flex overflow clipping */

aside.sidebar:not(:hover) .user-profile-widget {
    border-color: transparent;
    background-color: transparent;
}

.user-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details {
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

aside.sidebar:hover .user-details {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.1s;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-level {
    font-size: 0.75rem;
    color: var(--accent-blue);
    font-weight: 600;
}

.user-xp-bar {
    width: 100%;
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, height 0.2s ease;
}

aside.sidebar:hover .user-xp-bar {
    opacity: 1;
    visibility: visible;
    height: auto;
    transition-delay: 0.1s;
}

.xp-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.xp-progress-bg {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.xp-progress-fill {
    height: 100%;
    width: 45%;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-purple));
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Main Content Area */
main.main-content {
    flex: 1;
    overflow-y: auto;
    background: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* View Sections */
.app-section {
    display: none;
    padding: 32px 40px;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
}

.app-section.active {
    display: flex;
}

/* Section Header */
.section-header {
    margin-bottom: 28px;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.section-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Glassmorphic Components */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Dashboard Section Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.dashboard-left {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Heatmap Component */
.heatmap-card {
    padding: 24px;
}

.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 5px;
}

.heatmap-cell {
    aspect-ratio: 1;
    background-color: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.heatmap-cell:hover {
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.heatmap-cell.level-1 { background-color: rgba(59, 130, 246, 0.25); }
.heatmap-cell.level-2 { background-color: rgba(59, 130, 246, 0.45); }
.heatmap-cell.level-3 { background-color: rgba(59, 130, 246, 0.7); }
.heatmap-cell.level-4 { background-color: rgba(59, 130, 246, 1); }

/* Leaderboard Sidebar Card */
.leaderboard-card {
    padding: 24px;
    height: 100%;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: background-color 0.2s;
}

.leaderboard-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.leaderboard-item.highlight {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.08), transparent);
    border-left: 3px solid var(--accent-blue);
}

.rank-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.rank-badge.rank-1 { background-color: #fbbf24; color: #78350f; }
.rank-badge.rank-2 { background-color: #94a3b8; color: #1e293b; }
.rank-badge.rank-3 { background-color: #b45309; color: #fef3c7; }
.rank-badge.rank-other { color: var(--text-secondary); }

.leaderboard-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.leaderboard-xp {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* Recommended Challenge Card */
.recommend-card {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recommend-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recommend-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.difficulty-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    width: max-content;
}

.difficulty-badge.easy {
    background-color: var(--accent-emerald-glow);
    color: var(--accent-emerald);
}

.difficulty-badge.medium {
    background-color: var(--accent-gold-glow);
    color: var(--accent-gold);
}

.difficulty-badge.hard {
    background-color: var(--accent-rose-glow);
    color: var(--accent-rose);
}

/* Button Component */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

/* Challenges Filter Section */
.challenges-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
    fill: none;
}

.input-field {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--accent-blue);
}

.filter-tags {
    display: flex;
    gap: 8px;
}

.filter-tag {
    padding: 6px 14px;
    border-radius: 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

/* Challenges Grid */
.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.challenge-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.challenge-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(99, 102, 241, 0.2);
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.challenge-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.challenge-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.challenge-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Workspace Interactive View */
.workspace-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.workspace-left {
    flex: 1;
    min-width: 320px;
    border-right: 1px solid var(--border-color);
    background-color: rgba(15, 22, 38, 0.4);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.workspace-right {
    flex: 1.3;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.workspace-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    cursor: pointer;
}

.workspace-back-btn:hover {
    color: var(--text-primary);
}

.workspace-back-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.workspace-challenge-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.workspace-body {
    font-size: 0.92rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.workspace-body h4 {
    color: var(--text-primary);
    margin-top: 12px;
    font-weight: 600;
}

.code-block {
    background-color: #030712;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--font-code);
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    white-space: pre;
    color: #cbd5e1;
}

/* Code Editor Component */
.editor-header {
    height: 52px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.editor-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-language-select {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
}

.editor-area-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    background-color: #050a14;
    overflow: hidden;
}

.editor-line-numbers {
    width: 44px;
    padding: 16px 8px;
    text-align: right;
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: rgba(3, 7, 18, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    user-select: none;
    line-height: 1.5;
}

.editor-textarea {
    flex: 1;
    background-color: transparent;
    border: none;
    resize: none;
    outline: none;
    color: #e2e8f0;
    font-family: var(--font-code);
    font-size: 0.85rem;
    padding: 16px;
    line-height: 1.5;
    tab-size: 4;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
}

/* Terminal / Output Console */
.terminal-panel {
    height: 220px;
    background-color: #020617;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.terminal-header {
    height: 40px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.terminal-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.terminal-actions {
    display: flex;
    gap: 8px;
}

.terminal-body {
    flex: 1;
    padding: 16px;
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: #cbd5e1;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.6;
}

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

.terminal-stdout { color: #94a3b8; }
.terminal-success { color: var(--accent-emerald); }
.terminal-error { color: #f87171; }
.terminal-info { color: #60a5fa; }

/* Community Forum styling */
.community-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 28px;
}

.post-composer {
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.forum-posts {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.forum-post-card {
    padding: 20px;
    display: flex;
    gap: 16px;
}

.vote-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.vote-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s;
}

.vote-btn:hover, .vote-btn.active {
    color: var(--accent-blue);
}

.vote-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.vote-count {
    font-size: 0.85rem;
    font-weight: 600;
}

.post-main {
    flex: 1;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-author {
    color: var(--text-secondary);
    font-weight: 600;
}

.post-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.post-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.post-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-comment-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.post-comment-btn:hover {
    color: var(--text-secondary);
}

.post-comment-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

/* Community Sidebar rules */
.community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-info-card {
    padding: 20px;
}

/* Contact / Support Styling */
.support-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px;
}

.support-form-card {
    padding: 28px;
}

.support-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.textarea-field {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    min-height: 120px;
    resize: vertical;
    transition: border-color 0.2s;
}

.textarea-field:focus {
    border-color: var(--accent-blue);
}

.support-info-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.agent-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.agent-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.agent-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.agent-meta h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.agent-meta p {
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 500;
}

.agent-contact-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
}

.contact-row svg {
    width: 18px;
    height: 18px;
    stroke: var(--accent-blue);
    fill: none;
}

/* Sign In Page Styling */
.auth-section {
    align-items: center;
    justify-content: center;
    padding-top: 0;
    min-height: 100vh;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-purple));
}

.auth-header {
    text-align: center;
}

.auth-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px auto;
    display: block;
}

.auth-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.forgot-password-link {
    font-size: 0.8rem;
    color: var(--accent-blue);
    text-decoration: none;
    align-self: flex-end;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-blue);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { border-left-color: var(--accent-emerald); }
.toast.error { border-left-color: var(--accent-rose); }
.toast.info { border-left-color: var(--accent-blue); }

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive Rules */
@media (max-width: 1024px) {
    .dashboard-grid, .community-container, .support-container {
        grid-template-columns: 1fr;
    }
    .leaderboard-card, .community-sidebar, .support-info-cards {
        margin-top: 24px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }
    aside.sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: 12px 20px;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    aside.sidebar:hover {
        width: 100%;
        padding: 12px 20px;
    }
    .sidebar-top {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    .brand-section {
        margin-bottom: 0;
    }
    .nav-links {
        flex-direction: row;
        gap: 16px;
    }
    .nav-link span, .user-profile-widget {
        display: none !important;
    }
    .brand-name {
        display: none !important;
    }
    .app-section {
        padding: 20px;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .workspace-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .workspace-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 20px;
    }
    .workspace-right {
        height: 500px;
    }
    
    /* Challenges Toolbar stacking logic */
    .challenges-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .search-input-wrapper {
        max-width: 100%;
    }
    .filter-tags {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    aside.sidebar {
        padding: 8px 10px;
    }
    aside.sidebar:hover {
        padding: 8px 10px;
    }
    .nav-links {
        gap: 8px; /* Fit navigation items cleanly on smaller screens */
    }
    .stats-row {
        grid-template-columns: 1fr; /* Stack dashboard stats cards */
    }
    .stat-card {
        padding: 14px 16px;
    }
    .stat-value {
        font-size: 1.2rem;
    }
    .app-section {
        padding: 16px 12px;
    }
    .auth-card {
        padding: 24px 16px;
    }
    .section-title {
        font-size: 1.4rem;
    }
    .workspace-left, .workspace-right {
        padding: 16px 12px;
    }
    .forum-post-card {
        padding: 12px;
        gap: 10px;
    }
    .post-title {
        font-size: 1rem;
    }
    .post-body {
        font-size: 0.85rem;
    }
    
    /* Console panel layout fixes for overflow prevention */
    .terminal-header {
        padding: 0 8px;
    }
    .terminal-title {
        font-size: 0.72rem;
    }
    .terminal-actions {
        gap: 4px;
    }
    .terminal-actions .btn {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }
    
    /* Support Details break handling */
    .contact-row span {
        word-break: break-all;
        overflow-wrap: anywhere;
    }
}