/* Custom Styles for Cloud Architect Study Guide */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #f59e0b;
    --text-color: #374151;
    --text-muted: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --sidebar-width: 280px;
}

/* General Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
    color: var(--text-color);
    line-height: 1.8;
    background-color: #fff;
}

/* Navbar */
.navbar {
    height: 56px;
}

.navbar-brand {
    font-size: 1.1rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
    color: white;
    padding: 120px 0 80px;
    margin-top: 56px;
}

.hero-section h1 {
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Stats Section */
.stats-section {
    background-color: var(--bg-light);
}

.stat-item {
    padding: 1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Section Title */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary-color);
    display: inline-block;
}

/* Chapter Cards on Homepage */
.chapter-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    background: white;
    overflow: hidden;
}

.chapter-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.chapter-card .card-body {
    padding: 1.25rem;
}

.chapter-card .chapter-number {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.chapter-card .chapter-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0;
    line-height: 1.5;
}

/* Sidebar Styles */
.sidebar {
    background-color: var(--bg-light);
    border-right: 1px solid var(--border-color);
    min-height: calc(100vh - 56px);
}

.sidebar-heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.list-group-item {
    border: none;
    border-radius: 0 !important;
    padding: 0.625rem 1rem;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.list-group-item:hover {
    background-color: #e5e7eb;
    color: var(--primary-color);
}

.list-group-item.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 56px);
    margin-top: 56px;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 100px;
}

/* Markdown Body Styles */
.markdown-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

.markdown-body h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--primary-dark);
}

.markdown-body h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.markdown-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.markdown-body h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.markdown-body p {
    margin-bottom: 1rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-style: italic;
}

.markdown-body code {
    background-color: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e11d48;
}

.markdown-body pre {
    background-color: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.markdown-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 0.9rem;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.markdown-body th {
    background-color: var(--bg-light);
    font-weight: 600;
}

.markdown-body tr:nth-child(even) {
    background-color: #f9fafb;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

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

.markdown-body hr {
    margin: 2rem 0;
    border-color: var(--border-color);
}

.markdown-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Chapter Navigation */
.chapter-nav {
    margin-top: 3rem;
}

.chapter-nav .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
}

/* Floating Navigation for Mobile */
.floating-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

/* Offcanvas Sidebar */
.offcanvas {
    width: var(--sidebar-width);
}

.offcanvas .list-group-item {
    border-bottom: 1px solid var(--border-color);
}

/* Progress Bar */
.progress {
    z-index: 1030;
}

/* Footer */
.footer {
    margin-top: auto;
}

/* Loading State */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.error-message .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .hero-section {
        padding: 80px 0 60px;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .content-wrapper {
        padding-bottom: 80px;
    }
    
    .markdown-body {
        font-size: 1rem;
    }
    
    .markdown-body h1 {
        font-size: 1.5rem;
    }
    
    .markdown-body h2 {
        font-size: 1.25rem;
    }
    
    .chapter-nav {
        margin-bottom: 60px;
    }
}

/* Highlight.js Customization */
.hljs {
    background: transparent;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background-color: rgba(37, 99, 235, 0.2);
}

/* Focus Styles */
.btn:focus,
.list-group-item:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
    outline: none;
}
