
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #1abc9c;
    --light-color: #f8f9fa;
    --dark-color: #2c3e50;
    --gray-light: #e9ecef;
    --gray: #6c757d;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 {
    font-family: 'Noto Serif SC', 'Georgia', serif;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition);
}

    a:hover {
        color: var(--accent-color);
    }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a2530 100%);
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

    .logo i {
        color: var(--accent-color);
        font-size: 2rem;
    }

.subtitle {
    font-size: 1rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}

.search-container {
    position: relative;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1.1rem;
}

#searchInput {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

    #searchInput:focus {
        outline: none;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }

.search-stats {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--accent-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.main-layout {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    min-height: 70vh;
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

    .sidebar-header h2 {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

.category-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-label {
    font-size: 0.9rem;
    color: var(--gray);
}

#categoryFilter {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    background-color: white;
    font-size: 0.9rem;
    color: var(--dark-color);
}

.theorem-list {
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
    padding: 0.5rem;
}

.theorem-item {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 6px;
    margin: 0.25rem;
}

    .theorem-item:hover {
        background-color: #f0f7ff;
        transform: translateX(3px);
    }

    .theorem-item.active {
        background-color: #e3f2fd;
        border-left: 4px solid var(--secondary-color);
        padding-left: calc(1rem - 4px);
    }

.theorem-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .theorem-name i {
        color: var(--accent-color);
        font-size: 0.85rem;
    }

.theorem-description {
    font-size: 0.9rem;
    color: var(--gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.theorem-tags {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background-color: #e9ecef;
    color: var(--gray);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

    .tag.limit {
        background-color: #e3f2fd;
        color: #1565c0;
    }

    .tag.continuity {
        background-color: #f3e5f5;
        color: #7b1fa2;
    }

    .tag.derivative {
        background-color: #e8f5e9;
        color: #2e7d32;
    }

    .tag.integral {
        background-color: #fff3e0;
        color: #ef6c00;
    }

    .tag.series {
        background-color: #fce4ec;
        color: #c2185b;
    }

.loading-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--gray);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-light);
    background-color: #f8fafc;
}

.info-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

    .info-card i {
        color: var(--accent-color);
        font-size: 1.2rem;
        margin-top: 0.2rem;
    }

    .info-card strong {
        display: block;
        margin-bottom: 0.25rem;
    }

    .info-card p {
        font-size: 0.85rem;
        color: var(--gray);
        line-height: 1.4;
    }

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.content-actions {
    display: flex;
    gap: 0.75rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-outline {
    background-color: white;
    border: 1px solid var(--gray-light);
    color: var(--dark-color);
}

    .btn-outline:hover, .btn-outline.active {
        background-color: #f0f7ff;
        border-color: var(--secondary-color);
        color: var(--secondary-color);
    }

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

    .btn-icon:hover {
        background-color: var(--gray-light);
        color: var(--dark-color);
    }

.theorem-detail {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.welcome-message {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--gray);
}

.welcome-icon {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.welcome-message h2 {
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

    .feature i {
        color: var(--accent-color);
        font-size: 1.2rem;
    }

.quick-start {
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    max-width: 600px;
    margin: 2rem auto 0;
    text-align: left;
}

    .quick-start h3 {
        text-align: center;
        margin-bottom: 1rem;
    }

    .quick-start ol {
        padding-left: 1.5rem;
    }

    .quick-start li {
        margin-bottom: 0.5rem;
        padding-left: 0.5rem;
    }

.theorem-content {
    padding: 2rem;
}

.theorem-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray);
}

    .meta-item i {
        color: var(--secondary-color);
    }

.statement-box, .proof-box, .relations-box, .exercises-box {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--gray-light);
}

    .statement-box:last-child, .proof-box:last-child, .relations-box:last-child, .exercises-box:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
    font-size: 1.3rem;
}

    .section-title i {
        color: var(--secondary-color);
    }

.statement-text {
    background-color: #f8fafc;
    border-left: 4px solid var(--secondary-color);
    padding: 1.5rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-size: 1.1rem;
    line-height: 1.7;
    font-family: 'Noto Serif SC', 'Georgia', serif;
    margin-top: 0.5rem;
}

.proof-content {
    line-height: 1.7;
    padding: 1.5rem;
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
}

    .proof-content.hidden {
        display: none;
    }

.relation-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .relation-lists {
        grid-template-columns: 1fr;
    }
}

.relation-list {
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

    .relation-list h4 {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 1rem;
        color: var(--dark-color);
        font-size: 1.1rem;
    }

        .relation-list h4 i {
            color: var(--accent-color);
        }

.relation-item {
    display: block;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border-radius: 6px;
    border-left: 3px solid var(--secondary-color);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--dark-color);
}

    .relation-item:hover {
        background-color: #e3f2fd;
        transform: translateX(5px);
    }

    .relation-item .theorem-name {
        font-weight: 600;
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }

    .relation-item .theorem-description {
        font-size: 0.85rem;
        color: var(--gray);
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

.exercise-item {
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--accent-color);
}

    .exercise-item:last-child {
        margin-bottom: 0;
    }

.exercise-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

    .exercise-title span {
        font-weight: 600;
        color: var(--dark-color);
    }

.exercise-difficulty {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
}

.difficulty-easy {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.difficulty-medium {
    background-color: #fff3e0;
    color: #f57c00;
}

.difficulty-hard {
    background-color: #ffebee;
    color: #c62828;
}

.exercise-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.graph-preview {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

    .graph-header h3 {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin: 0;
    }

.graph-container {
    padding: 2rem;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.graph-placeholder {
    text-align: center;
    color: var(--gray);
}

    .graph-placeholder i {
        font-size: 3rem;
        margin-bottom: 1rem;
        color: #e0e0e0;
    }

    .graph-placeholder p {
        font-size: 0.95rem;
    }

.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p {
    font-size: 0.9rem;
    opacity: 0.85;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.85;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    opacity: 0.7;
}

@media (max-width: 1100px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .theorem-list {
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .content-header {
        flex-direction: column;
        gap: 1rem;
    }

    .content-actions {
        align-self: stretch;
    }

    .btn {
        flex: 1;
        justify-content: center;
    }

    .feature-list {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

.hidden {
    display: none !important;
}

.text-muted {
    color: var(--gray);
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray);
}

    .empty-state i {
        font-size: 3rem;
        margin-bottom: 1rem;
        opacity: 0.5;
    }
.katex {
    font-size: 1.1em;
    font-family: "KaTeX_Main", "Times New Roman", serif;
}

.katex-display {
    overflow: auto hidden;
    padding: 1em 0;
    margin: 1em 0;
    background-color: #f8f9fa;
    border-radius: 4px;
    text-align: center;
}

.katex-inline {
    display: inline-block;
    vertical-align: middle;
}

.katex-content {
    font-family: "KaTeX_Main", "Times New Roman", serif;
    line-height: 1.6;
}

.statement, .explanation, .proof, .example-content {
    font-size: 1.1em;
    line-height: 1.8;
}

    .statement .katex-display,
    .explanation .katex-display,
    .proof .katex-display {
        background-color: #f5f7fa;
        padding: 1.5em;
        border-left: 4px solid #4a6fa5;
        margin: 1.5em 0;
    }

    .example-content .katex-display {
        background-color: #f0f7ff;
        padding: 1em;
        border-radius: 6px;
        margin: 1em 0;
    }

@media (max-width: 1100px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .theorem-list {
        max-height: 280px;
        border-bottom: 1px solid var(--gray-light);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header {
        padding: 1.5rem 0 1rem;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    .search-container {
        width: 100%;
    }

    .content-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1.2rem;
    }

    .content-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .btn {
        flex: 1;
        justify-content: center;
        padding: 0.8rem;
    }

    .btn-icon {
        padding: 0.8rem;
        margin-left: 0.5rem;
    }

    .theorem-content {
        padding: 1.25rem;
    }

    .theorem-meta {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .statement-text, .proof-content {
        padding: 1rem;
        font-size: 1rem;
    }

    .graph-container {
        padding: 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; 
    }

    .katex-display {
        overflow-x: auto;
        padding: 0.8em;
        margin: 1em 0;
        -webkit-overflow-scrolling: touch;
    }

    .katex {
        font-size: 0.95em; 
    }

    .relation-lists, .feature-list, .footer-content {
        grid-template-columns: 1fr;
    }

    .relation-lists {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    h1, h2 {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .theorem-name {
        font-size: 1rem;
    }

    .welcome-message {
        padding: 2rem 1rem;
    }
}