/* Base styles and variables */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #1e293b;
    --secondary-dark: #0f172a;
    --text-color: #334155;
    --text-light: #64748b;
    --text-dark: #1e293b;
    --background-color: #f8fafc;
    --card-color: #ffffff;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
    --container-width: 1200px;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    font-family: inherit;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

/* Header */
header {
    background-color: var(--card-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo a {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-dark);
}

.logo i {
    color: var(--primary-color);
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

nav ul {
    display: flex;
}

nav li {
    margin-left: 1.5rem;
}

nav a {
    color: var(--text-color);
    font-weight: 500;
}

nav a.active, nav a:hover {
    color: var(--primary-color);
}

#menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
}

/* Hero Section */
.hero {
    background: linear-gradient(to right, var(--secondary-dark), var(--primary-dark));
    color: white;
    padding: 5rem 0;
    text-align: center;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
    border: none;
}

.btn i {
    margin-right: 0.5rem;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-dark);
}

.btn.secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(5px);
}

.btn.secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Features Section */
.features {
    padding: 5rem 0;
    background-color: var(--card-color);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
}

/* Chapters Section */
.chapters {
    padding: 5rem 0;
}

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.chapter-card {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.chapter-header {
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
}

.chapter-header i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.chapter-body {
    padding: 1.5rem;
}

.chapter-body h4 {
    margin-bottom: 1rem;
}

.read-more {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.read-more i {
    margin-left: 0.25rem;
    transition: var(--transition);
}

.chapter-card:hover .read-more i {
    transform: translateX(3px);
}

/* Chapter Content Page */
.chapter-content {
    padding: 3rem 0;
}

.chapter-container {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    max-width: 900px;
    margin: 0 auto;
}

.chapter-title {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chapter-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.nav-button {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    transition: var(--transition);
}

.nav-button:hover {
    background-color: var(--primary-dark);
    color: white;
}

.nav-button.prev i {
    margin-right: 0.5rem;
}

.nav-button.next i {
    margin-left: 0.5rem;
}

.nav-button.disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.5;
}

.back-to-home {
    display: inline-flex;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--text-light);
    font-weight: 500;
}

.back-to-home i {
    margin-right: 0.5rem;
}

.back-to-home:hover {
    color: var(--primary-color);
}

/* Content Styling */
.content {
    line-height: 1.7;
}

.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content h2 {
    font-size: 1.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.content h3 {
    font-size: 1.5rem;
}

.content p {
    margin-bottom: 1rem;
}

.content ul, .content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content ul {
    list-style-type: disc;
}

.content ol {
    list-style-type: decimal;
}

.content li {
    margin-bottom: 0.5rem;
}

.content a {
    color: var(--primary-color);
    text-decoration: underline;
}

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

.content code {
    font-family: 'Courier New', Courier, monospace;
    background-color: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.content pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
}

.content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.content th {
    background-color: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.content td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
}

.content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
}

/* Print styles */
@media print {
    header, footer, .chapter-navigation, .back-to-home {
        display: none !important;
    }

    .chapter-container {
        box-shadow: none;
        max-width: none;
        padding: 0;
    }

    body {
        background-color: white;
    }

    .content {
        font-size: 12pt;
    }

    .content pre {
        white-space: pre-wrap;
        word-wrap: break-word;
        border: 1px solid #ddd;
    }
}

/* Footer */
footer {
    background-color: var(--secondary-dark);
    color: white;
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: bold;
}

.footer-logo i {
    color: var(--primary-color);
    margin-right: 0.5rem;
    font-size: 1.5rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
}

.footer-links a:hover {
    color: white;
}

.footer-links i {
    margin-right: 0.5rem;
}

.footer-copyright {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive styles */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .features, .chapters {
        padding: 3rem 0;
    }

    #menu-toggle {
        display: block;
    }

    #main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--card-color);
        box-shadow: var(--shadow-md);
        flex-direction: column;
        padding: 1rem 0;
        display: none;
    }

    #main-nav.active {
        display: flex;
    }

    nav li {
        margin: 0;
    }

    nav a {
        display: block;
        padding: 0.75rem 2rem;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .chapter-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .chapter-container {
        padding: 1.5rem;
    }
}
