/* Main Styles for CAIO Ebook Website */

/* Base Styles and Variables */
:root {
    --primary-color: #0056b3;
    --secondary-color: #003366;
    --accent-color: #00a0e9;
    --text-color: #333333;
    --light-text: #ffffff;
    --background-color: #ffffff;
    --sidebar-bg: #f8f9fa;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --border-radius: 4px;
    --content-width: 1200px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 1rem;
    color: var(--secondary-color);
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

h3 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
}

h4 {
    font-size: 1.25rem;
    margin-top: 1.25rem;
}

p {
    margin-bottom: 1.2rem;
}

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

a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

ul, ol {
    margin-bottom: 1.2rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

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

/* Container Layout */
.container {
    display: flex;
    min-height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 0;
}

.sidebar-nav {
    padding: 1.5rem 0;
}

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

.nav-item {
    margin-bottom: 0;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    text-decoration: none;
}

.nav-link.active {
    background-color: rgba(0, 86, 179, 0.1);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    font-weight: 600;
}

.nav-link.chapter {
    padding-left: 2.5rem;
    font-size: 0.95rem;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 280px);
}

.site-header {
    background-color: var(--background-color);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
}

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
}

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--secondary-color);
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Chapter Content Styles */
.chapter-content {
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
}

.chapter-header {
    margin-bottom: 2rem;
    text-align: center;
}

.chapter-header h1 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.table-of-contents {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.table-of-contents h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.toc-list {
    list-style: none;
    padding-left: 0;
}

.toc-h2 {
    margin-bottom: 0.5rem;
}

.toc-h3 {
    padding-left: 1.5rem;
    font-size: 0.9rem;
}

/* Infographic Styles */
.infographic {
    margin: 2rem 0;
    text-align: center;
}

.full-width-image {
    max-width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 0 auto;
}

.infographic-caption {
    margin-top: 1rem;
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
}

/* Template Box Styles */
.template-box {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.template-box h3 {
    margin-top: 0;
    color: var(--secondary-color);
}

.template-box h4 {
    margin-top: 1.5rem;
    color: var(--secondary-color);
}

.template-box h5 {
    margin-top: 1.25rem;
    font-size: 1.1rem;
}

.template-box ul {
    margin-bottom: 1rem;
}

/* Navigation Between Chapters */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--light-text);
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 600;
}

.btn:hover {
    background-color: var(--secondary-color);
    color: var(--light-text);
    text-decoration: none;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Footer Styles */
.site-footer {
    background-color: var(--secondary-color);
    color: var(--light-text);
    padding: 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: var(--content-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-nav {
    margin-bottom: 1rem;
}

.footer-nav a {
    color: var(--light-text);
    margin: 0 1rem;
}

.footer-nav a:hover {
    color: rgba(255, 255, 255, 0.8);
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Home Page Specific Styles */
.hero-section {
    text-align: center;
    padding: 3rem 0;
}

.hero-image {
    max-width: 80%;
    margin: 0 auto 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #666;
}

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

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

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.chapter-card-image {
    height: 160px;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-text);
    font-size: 2rem;
}

.chapter-card-content {
    padding: 1.5rem;
}

.chapter-card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.chapter-card-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
        max-width: calc(100% - 240px);
    }
    
    .content-wrapper {
        padding: 1.5rem;
    }
    
    .chapter-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
    }
    
    .mobile-nav-toggle {
        display: block;
    }
    
    .site-header {
        padding: 1rem;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .chapter-content {
        padding: 1.5rem;
    }
    
    .chapter-header h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .chapters-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .content-wrapper {
        padding: 1rem 0.5rem;
    }
    
    .chapter-content {
        padding: 1rem;
    }
    
    .chapter-header h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .chapter-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
}
