:root {
    --bg-dark: #0a0f1e;
    --bg-sidebar: #111827;
    --bg-panel: #1e293b;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.4);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --easy: #10b981;
    --medium: #f59e0b;
    --hard: #ef4444;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.5);
    --radius-lg: 12px;
    --radius-md: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0a0f1e 100%);
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 28px 20px;
    gap: 16px;
    height: 100vh;
    overflow: hidden;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}

.route-selector-container {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-btn {
    width: 100%;
}

.panel-header {
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    /* Slightly smaller */
    font-weight: 700;
    padding: 4px 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.phase-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topics {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.topic-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    width: 100%;
}

.topic-btn:hover {
    background-color: var(--glass);
    color: var(--text-main);
    padding-left: 20px;
}

.topic-btn.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.15) 0%, transparent 100%);
    color: var(--accent);
    font-weight: 600;
    border-left: 3px solid var(--accent);
    padding-left: 20px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 16px;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

.status-dot.online {
    background-color: var(--easy);
}

.status-dot.online::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--easy);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.content-header {
    align-items: center;
    background-color: rgba(10, 15, 30, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    padding: 16px 32px;
    /* Slightly reduced */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-height: 80px;
}

.problem-title {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Reduced from 20px */
    max-width: 40%;
}

.problem-title h2 {
    font-size: 18px;
    /* Slightly smaller */
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actions {
    display: flex;
    gap: 8px;
    /* Reduced from 12px */
    align-items: center;
}

.btn {
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    /* Uniform smaller size */
    font-weight: 700;
    padding: 10px 16px;
    /* Reduced side padding */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 100%);
    color: #000;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
    filter: brightness(1.1);
}

.btn.secondary {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: #fff;
}

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

.select-btn {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    /* Adjusted */
    background-size: 10px;
    /* Smaller */
    padding-right: 32px;
    /* Reduced */
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--accent);
    font-size: 9px;
    /* Smaller */
    font-weight: 800;
    padding: 6px 10px;
    /* Compact */
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    height: 32px;
    /* Consistent height */
    display: flex;
    align-items: center;
}

.difficulty-btn:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
}

/* Workspace Layout */
.workspace {
    display: grid;
    grid-template-columns: 420px 1fr;
    flex-grow: 1;
    overflow: hidden;
    gap: 1px;
    background-color: var(--glass-border);
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-dark);
}

.left-panel {
    background-color: #0f172a;
}

.panel-body {
    padding: 32px;
    font-size: 15px;
    line-height: 1.8;
    color: #cbd5e1;
    flex-grow: 1;
    overflow-y: auto;
}

.panel-body b {
    color: var(--accent);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    opacity: 0.9;
}

/* Test Cases */
.test-cases {
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.test-case-item {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: transform 0.2s;
}

.test-case-item:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.05);
}

.test-case-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--text-muted);
}

/* Editor & Console */
#editor-container {
    flex-grow: 1;
    background-color: #0d1117;
}

.console {
    height: 220px;
    background-color: #010409;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.output-content {
    flex-grow: 1;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: #e6edf3;
    overflow-y: auto;
    line-height: 1.6;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 32px;
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content {
    color: var(--text-main);
}

.modal h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.solution-code-container {
    background: #0f172a;
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 8px 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.solution-code-container pre {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #e2e8f0;
}

.modal-footer {
    display: flex;
    justify-content: center;
}

#close-modal {
    padding: 12px 32px;
    min-width: 150px;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}