/* ===== CSS Reset and Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Typography ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 16px;
    line-height: 1.6;
    color: #212529;
    background-color: #f8f9fa;
}

/* ===== Color Variables ===== */
:root {
    --primary-blue: #0D6EFD;
    --success-green: #198754;
    --danger-red: #DC3545;
    --warning-yellow: #FFC107;
    --info-cyan: #0DCAF0;
    --light-gray: #F8F9FA;
    --medium-gray: #6C757D;
    --dark-gray: #212529;
    --white: #FFFFFF;
}

/* ===== Layout: Sidebar + Main Content ===== */
body {
    display: flex;
    min-height: 100vh;
}

/* ===== Left Sidebar Navigation ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background-color: var(--white);
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 1000;
}

.logo-container {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.logo-link {
    display: block;
    text-decoration: none;
}

.logo {
    max-width: 100%;
    height: auto;
}

.website-link {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: text-decoration 0.2s;
}

.website-link:hover {
    text-decoration: underline;
}

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

.nav-item {
    height: 80px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
}

.nav-item a {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0 1.5rem;
    text-decoration: none;
    color: var(--dark-gray);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.nav-item a:hover {
    background-color: var(--light-gray);
    color: var(--primary-blue);
}

.nav-item.active a {
    background-color: var(--primary-blue);
    color: var(--white);
}

.nav-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
}

/* ===== Main Content Area ===== */
.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 0;
    background-color: var(--light-gray);
}

/* ===== Hero Section ===== */
.hero {
    width: 1000px;
    height: 340px;
    margin: 2rem auto;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0a58ca 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hero-content {
    text-align: left;
    color: var(--white);
    padding: 2rem;
    width: 100%;
    max-width: 900px;
}

.version-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-align: left;
}

.hero-subtitle {
    font-size: 1.125rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    opacity: 0.95;
    text-align: left;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.cta-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s, border-color 0.2s;
}

.cta-button.primary {
    background-color: var(--white);
    color: var(--primary-blue);
    border: none;
}

.cta-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cta-button.secondary {
    background-color: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.cta-button.secondary:hover {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===== Content Sections ===== */
.overview-section,
.chapter-nav-section {
    width: 1000px;
    margin: 2rem auto;
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--primary-blue);
}

.overview-content p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.7;
    color: #495057;
}

.overview-content p:last-child {
    margin-bottom: 0;
}

/* ===== Chapter Navigation Grid ===== */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.chapter-card {
    height: 130px;
    background-color: var(--white);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.chapter-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(13, 110, 253, 0.15);
    border-color: var(--primary-blue);
}

.chapter-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.chapter-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.chapter-number {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary-blue);
    background-color: rgba(13, 110, 253, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* ===== Chapter Content Pages ===== */
.chapter-content {
    width: 1000px;
    margin: 2rem auto;
    background-color: var(--white);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chapter-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary-blue);
}

.chapter-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
}

.chapter-meta {
    font-size: 0.875rem;
    color: var(--medium-gray);
}

.chapter-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.chapter-body h3 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-top: 2rem;
    margin-bottom: 0.875rem;
}

.chapter-body p {
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.7;
    color: #495057;
}

.chapter-body img {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chapter-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

.chapter-body table th {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 0.875rem;
    text-align: left;
    font-weight: 600;
}

.chapter-body table td {
    padding: 0.875rem;
    border-bottom: 1px solid #dee2e6;
}

.chapter-body table tr:hover {
    background-color: var(--light-gray);
}

.chapter-body blockquote {
    border-left: 4px solid var(--primary-blue);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--medium-gray);
}

.chapter-body ul,
.chapter-body ol {
    margin-left: 2rem;
    margin-bottom: 1.25rem;
}

.chapter-body li {
    margin-bottom: 0.5rem;
}

.chapter-body strong {
    font-weight: 600;
    color: var(--dark-gray);
}

/* ===== Calculator Section ===== */
.calculator-container {
    background-color: var(--light-gray);
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
}

.calculator-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
}

.calculator-input-group {
    margin-bottom: 1.25rem;
}

.calculator-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-gray);
}

.calculator-input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
}

.calculator-button {
    background-color: var(--primary-blue);
    color: var(--white);
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.calculator-button:hover {
    background-color: #0a58ca;
}

.calculator-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--white);
    border-radius: 8px;
    border-left: 4px solid var(--success-green);
}

.calculator-result h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--success-green);
    margin-bottom: 0.75rem;
}

.calculator-result p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin: 0;
}

/* ===== Responsive Design ===== */
@media (max-width: 1280px) {
    .hero,
    .overview-section,
    .chapter-nav-section,
    .chapter-content {
        width: 90%;
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .chapter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-title {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .nav-item {
        height: 60px;
    }
    
    .chapter-grid {
        grid-template-columns: 1fr;
    }
    
    .hero {
        height: auto;
        min-height: 280px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
}
