/* ===================================
   CSS Variables
   =================================== */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --text-color: #333;
    --text-light: #6c757d;
    --bg-color: #fff;
    --bg-light: #f8f9fa;
    --border-color: #e0e0e0;
    --hover-color: #2980b9;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
}

/* ===================================
   Post Layout Styles (for post.html)
   =================================== */
.post-title {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
}

.post-meta {
    color: var(--text-light);
    font-size: 0.85rem;
}

.post-meta .post-categories,
.post-meta .post-tags {
    margin-top: 0.25rem;
}

.post-content {
    line-height: 1.6;
    font-size: 0.95rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.post-content ul,
.post-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.post-content li {
    margin-bottom: 0.25rem;
}

.post-content code {
    background: var(--bg-light);
    padding: 0.15rem 0.3rem;
    border-radius: 2px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    color: var(--danger-color);
}

.post-content pre {
    background: #272822;
    color: #f8f8f2;
    padding: 0.75rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
}

.post-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.post-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 0.75rem;
    margin: 1rem 0;
    color: var(--text-light);
    font-style: italic;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.post-content table th,
.post-content table td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

.post-content table th {
    background: var(--bg-light);
    font-weight: 600;
}

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.prev-post,
.next-post {
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 5px;
}

.prev-post span,
.next-post span {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.back-to-categories {
    text-align: center;
}

.tag {
    display: inline-block;
    background: var(--bg-light);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: white;
    text-decoration: none;
}

/* ===================================
   Button Styles
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: var(--primary-color);
    color: white !important;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn:hover {
    background: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
    text-decoration: none;
}

.btn-primary {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--hover-color) 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--hover-color) 0%, #21618c 100%);
}

.btn-icon {
    transition: transform 0.3s ease;
}

.btn:hover .btn-icon {
    transform: translateX(3px);
}

/* ===================================
   Home Page Styles (for home.html)
   =================================== */
.home-page {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.home-header {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.home-title {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.home-subtitle {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.search-tip {
    display: inline-block;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #ffc107;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #856404;
}

.search-tip kbd {
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0.2rem 0.4rem;
    font-family: monospace;
}

.section-title {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, #f8f9fa 0%, transparent 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
}

.section-range {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: normal;
}

.subsection {
    margin-bottom: 1.5rem;
}

.subsection-title {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    border-left: 3px solid var(--success-color);
}

.question-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.question-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.4rem;
    background: white;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.question-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    transform: translateX(3px);
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 22px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--hover-color) 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    flex-shrink: 0;
}

.question-link {
    flex: 1;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.question-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.question-category {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: white;
    background: var(--primary-color);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
}

/* Sidebar Navigation */
.sidebar-nav {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    max-width: 220px;
    max-height: 70vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-nav.show {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9rem;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-link {
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--bg-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    text-decoration: none;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--hover-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.5);
}

/* ===================================
   Responsive Design
   =================================== */
@media screen and (max-width: 1199px) {
    .sidebar-nav {
        display: none;
    }
}

@media screen and (max-width: 768px) {
    .home-header {
        padding: 1.5rem 0;
    }

    .home-title {
        font-size: 1.5rem;
    }

    .search-tip {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }

    .section-title {
        font-size: 1.25rem;
        padding: 0.6rem 0.75rem;
    }

    .subsection-title {
        font-size: 1rem;
    }

    .question-item {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .question-category {
        margin-left: auto;
    }

    .back-to-top {
        width: 44px;
        height: 44px;
        bottom: 1rem;
        right: 1rem;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    .home-title {
        font-size: 1.25rem;
    }

    .question-link {
        font-size: 0.9rem;
    }

    .question-number {
        min-width: 28px;
        height: 20px;
        font-size: 0.7rem;
    }
}