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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* Header */
.app-header {
    background-color: #282c34;
    padding: 20px;
    color: white;
    text-align: center;
}

.app-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.app-header p {
    opacity: 0.8;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 100px);
    gap: 20px;
    padding: 20px;
}

/* Panels */
.left-panel {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Problem List */
.problem-list {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    flex: 1;
}

.problem-list h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
}

.problem-item {
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.problem-item:hover {
    background-color: #f0f0f0;
    border-color: #007bff;
}

.problem-item.selected {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.problem-item h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: #333;
}

.problem-category {
    display: inline-block;
    padding: 2px 8px;
    background-color: #f0f0f0;
    border-radius: 3px;
    font-size: 0.8rem;
    color: #666;
}

/* Statistics */
.statistics {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 180px;
}

.statistics h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #333;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.recent-problems {
    margin-top: 20px;
}

.recent-problems h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #555;
}

.recent-problem-item {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

/* Problem Content */
.problem-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.no-problem-selected {
    text-align: center;
    padding: 40px;
}

.no-problem-selected h2 {
    color: #333;
    margin-bottom: 10px;
}

.no-problem-selected p {
    color: #666;
}

/* Problem Viewer */
.problem-viewer {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.problem-header {
    margin-bottom: 15px;
    flex-shrink: 0;
}

.problem-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 15px;
}

.tab {
    padding: 8px 16px;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    transition: all 0.3s;
}

.tab:hover {
    color: #333;
    background-color: #f5f5f5;
}

.tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: 600;
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.problem-section {
    margin-bottom: 20px;
}

.problem-section h3 {
    color: #555;
    font-size: 1rem;
    margin-bottom: 8px;
}

.problem-section pre {
    background-color: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

.problem-section p {
    line-height: 1.6;
    font-size: 0.95rem;
}

.solution-section, .explanation-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.solution-section h3, .explanation-section h3 {
    color: #555;
    font-size: 1rem;
    margin: 0;
}

.explanation-section h3 {
    margin-bottom: 10px;
}

.copy-button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.copy-button.copied {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.copy-button svg {
    width: 16px;
    height: 16px;
}

.solution-code {
    flex: 1;
    overflow-y: auto;
    background-color: #1e1e1e;
    border-radius: 4px;
    padding: 0;
    margin: 0;
    min-height: 0;
}

.solution-code code {
    display: block;
    padding: 15px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.explanation-text {
    flex: 1;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    overflow-y: auto;
}

/* Code Editor */
.code-editor {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    min-height: 250px;
    max-height: 45%;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.editor-header h3 {
    color: #333;
    font-size: 1rem;
}

.timer {
    font-size: 1.1rem;
    font-weight: 600;
    color: #666;
    padding: 5px 15px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.submit-button {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.submit-button:hover {
    background-color: #218838;
}

.submit-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.code-textarea {
    flex: 1;
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    line-height: 1.6;
}

.code-textarea:focus {
    border-color: #007bff;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.modal-content p {
    margin-bottom: 15px;
    color: #666;
    font-size: 1.1rem;
}

.modal-close {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.modal-close:hover {
    background-color: #0056b3;
}

/* Responsive */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .left-panel {
        width: 100%;
        flex-direction: row;
        height: auto;
    }
    
    .problem-list,
    .statistics {
        flex: 1;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}