:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #333333;
    --text-secondary: #666666;
    --accent-color: #4a90e2;
    --border-color: #e0e0e0;
    --success-color: #4caf50;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #404040;
    --shadow-color: rgba(255, 255, 255, 0.05);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

header {
    background-color: var(--bg-secondary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow-color);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 1px 2px var(--shadow-color);
}

.nav-controls button {
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.nav-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.nav-controls button:active {
    transform: translateY(0);
}

.split-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 4rem);
}

.editor-section, .proof-section {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.editor-wrapper {
    position: relative;
}

.editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.editor-wrapper:hover .editor-overlay {
    opacity: 1;
}

.editor, .proof-display {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    min-height: 300px;
    font-size: 1.1rem;
    line-height: 1.8;
    transition: all 0.3s ease;
    white-space: pre-wrap;
}

.editor:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.button-group button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    flex: 1;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.button-group button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.typing-indicator {
    color: var(--text-secondary);
    font-style: italic;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-radius: 4px;
    background-color: var(--bg-primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.hidden {
    display: none;
}

.theorem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.online-users {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.user-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background-color: var(--accent-color);
    color: white;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 0.3rem;
}

.search-box {
    margin-bottom: 1.5rem;
}

.theorem-search {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.theorem-search:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.theorem-browser {
    position: fixed;
    right: 0;
    top: 4rem;
    width: 350px;
    height: calc(100vh - 4rem);
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: -2px 0 4px var(--shadow-color);
    transition: transform 0.3s ease;
    z-index: 100;
}

.theorem-card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.theorem-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.theorem-card h4 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.theorem-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#graph-visualization {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 350px;
    height: 300px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    box-shadow: 0 -2px 4px var(--shadow-color);
    transition: transform 0.3s ease;
}

.proof-step {
    padding: 1rem;
    margin: 0.5rem 0;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    border-left: 4px solid var(--accent-color);
    transition: all 0.3s ease;
}

.proof-step:hover {
    transform: translateX(4px);
}

.formal-step {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 6px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--bg-secondary);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .split-screen {
        grid-template-columns: 1fr;
        height: auto;
        padding: 1rem;
    }

    .theorem-browser {
        position: static;
        width: auto;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border-color);
        box-shadow: none;
        padding: 1rem;
    }

    .theorem-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .user-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }

    #graph-visualization {
        position: static;
        height: 400px;
        margin-top: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .nav-controls button {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

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

.proof-steps {
    animation: slideIn 0.3s ease;
}

.theorem-card {
    animation: slideIn 0.3s ease;
}
