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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-sidebar: #111111;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-primary: #ff4444;
    --accent-secondary: #cc0000;
    --accent-hover: #ff6666;
    --keyword-color: #ff6b6b;
    --success: #00ff88;
    --warning: #ffc01e;
    --error: #ff4444;
    --easy: #00ac5f;
    --medium: #ffc01e;
    --hard: #ff2d55;
    --border-color: #2a2a2a;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --bg-sidebar: #f1f3f5;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --keyword-color: #dc3545;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-primary);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 100;
}

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

.menu-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.menu-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

.logo-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    color: var(--accent-primary);
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.font-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 20px;
}

.font-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    transition: all 0.3s;
}

.font-btn:hover {
    background: var(--accent-primary);
}

.font-size {
    font-size: 14px;
    min-width: 30px;
    text-align: center;
}

.theme-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.theme-btn:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: -320px;
    top: 60px;
    width: 320px;
    height: calc(100vh - 60px);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    z-index: 99;
    box-shadow: var(--shadow);
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    margin-bottom: 15px;
    color: var(--accent-primary);
}

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

.filter-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.filter-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.filter-btn.active {
    background: var(--accent-primary);
    color: white;
}

.problems-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.problem-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.problem-item:hover {
    transform: translateX(5px);
    background: var(--bg-tertiary);
}

.problem-item.active {
    border-left-color: var(--accent-primary);
    background: var(--accent-secondary);
    color: white;
}

.problem-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

.problem-difficulty {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

.difficulty.easy { background: var(--easy); color: white; }
.difficulty.medium { background: var(--medium); color: #333; }
.difficulty.hard { background: var(--hard); color: white; }

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    gap: 1px;
    background: var(--border-color);
    overflow: hidden;
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

/* Resizer */
.resizer {
    width: 4px;
    background: var(--accent-primary);
    cursor: col-resize;
    position: relative;
    transition: background 0.2s;
}

.resizer:hover {
    background: var(--accent-hover);
}

/* Problem Panel */
.problem-panel {
    flex: 1;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
}

.problem-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.problem-header h2 {
    font-size: 20px;
}

.problem-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 16px;
}

.description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 25px;
}

.examples-section, .constraints-section {
    margin-bottom: 25px;
}

.examples-section h4, .constraints-section h4 {
    margin-bottom: 12px;
    color: var(--accent-primary);
    font-size: 14px;
}

.example-box {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    font-family: monospace;
}

.example-box strong {
    color: var(--accent-primary);
}

.constraints-section ul {
    list-style: none;
    padding-left: 0;
}

.constraints-section li {
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-size: 13px;
    padding-left: 20px;
    position: relative;
}

.constraints-section li:before {
    content: "•";
    color: var(--accent-primary);
    position: absolute;
    left: 0;
}

/* Editor Panel */
.editor-panel {
    flex: 1.5;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 400px;
}

.editor-header {
    background: var(--bg-tertiary);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.editor-tabs {
    display: flex;
    gap: 5px;
}

.editor-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 13px;
}

.editor-tab:hover {
    background: var(--bg-primary);
    color: var(--accent-primary);
}

.editor-tab.active {
    background: var(--accent-primary);
    color: white;
}

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

.action-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn.run {
    background: var(--accent-primary);
    color: white;
}

.action-btn.submit {
    background: var(--success);
    color: #333;
}

.action-btn.reset {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.editor-tab-content {
    display: none;
    flex: 1;
    overflow: auto;
}

.editor-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Editor Wrapper */
.editor-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.line-numbers {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 20px 10px;
    text-align: right;
    user-select: none;
    border-right: 1px solid var(--border-color);
    min-width: 50px;
}

.line-numbers span {
    display: block;
}

.code-editor {
    flex: 1;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 20px;
    border: none;
    resize: none;
    outline: none;
    line-height: 1.6;
    tab-size: 4;
}

/* Syntax Highlighting */
.keyword {
    color: var(--keyword-color);
    font-weight: bold;
}

/* Test Cases */
.testcases-container, .results-container {
    padding: 20px;
    overflow-y: auto;
}

.test-case {
    background: var(--bg-tertiary);
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    font-size: 13px;
}

.test-case strong {
    color: var(--accent-primary);
}

/* Results */
.results-summary {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.results-summary h3 {
    margin-bottom: 10px;
}

.result-item {
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    border-left: 4px solid;
    font-size: 13px;
}

.result-item.passed {
    border-left-color: var(--success);
    background: rgba(0, 255, 136, 0.1);
}

.result-item.failed {
    border-left-color: var(--error);
    background: rgba(255, 68, 68, 0.1);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

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

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.problem-item {
    animation: slideIn 0.3s ease;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-area {
        flex-direction: column;
    }
    
    .problem-panel {
        max-height: 40%;
    }
    
    .editor-panel {
        min-height: 60%;
    }
    
    .resizer {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }
    
    .editor-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .editor-actions {
        width: 100%;
        justify-content: center;
    }
}