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

:root {
    --primary-color: #2c5f2d;
    --secondary-color: #97b55d;
    --accent-color: #d4a017;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --border-radius: 5px;
}

/* Typography - Noto Sans Bengali for all */
body,
body *,
.assamese-text {
    font-family: 'Noto Sans Bengali', sans-serif !important;
}

body {
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--light-bg);
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 1.5rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 90vw;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.logo p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Navigation */
nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
}

nav a:hover,
nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Search Bar */
.search-container {
    max-width: 90vw;
    margin: 2rem auto;
    padding: 0 20px;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    background: var(--white);
    padding: 0.5rem;
    border-radius: 25px;
    box-shadow: var(--shadow);
}

.search-box input {
    flex: 1;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: 25px;
    outline: none;
}

.search-box button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.search-box button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Main Container */
.container {
    max-width: 90vw;
    margin: 0 auto;
    padding: 2rem 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* Content Section Wrapper */
main {
    width: 100%;
}

section {
    width: 100%;
}

.content-section {
    max-width: 90vw;
    margin: 0 auto;
    padding: 0 20px;
}

/* Sidebar */
.sidebar {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary-color);
}

.chapter-list {
    list-style: none;
}

.chapter-item {
    margin-bottom: 0.5rem;
}

.chapter-link {
    display: block;
    padding: 0.8rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.chapter-link:hover,
.chapter-link.active {
    background-color: var(--secondary-color);
    color: var(--white);
    transform: translateX(5px);
}

.topic-list {
    list-style: none;
    margin-top: 0.5rem;
    margin-left: 1rem;
    display: none;
}

.chapter-link.active + .topic-list {
    display: block;
}

.topic-link {
    display: block;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 2px solid transparent;
}

.topic-link:hover,
.topic-link.active {
    color: var(--primary-color);
    border-left-color: var(--accent-color);
    background-color: var(--light-bg);
}

/* Main Content */
.main-content {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-height: 500px;
}

.content-header {
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.content-header h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.content-header .meta {
    color: #666;
    font-size: 0.9rem;
}

/* Topic Content */
.topic-content {
    font-size: 1.05rem;
    line-height: 1.9;
}

.topic-content p {
    margin-bottom: 1.5rem;
}

.topic-content h3 {
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.topic-content ul,
.topic-content ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

/* Examples Box */
.examples-box {
    background: #fffbea;
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: var(--border-radius);
}

.examples-box h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Chapters Grid */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.chapter-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-color);
    border-top: 4px solid var(--secondary-color);
}

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

.chapter-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.chapter-card .topic-count {
    color: #666;
    font-size: 0.9rem;
}

/* Search Results */
.search-results {
    margin-top: 2rem;
}

.result-item {
    background: var(--white);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
    transition: var(--transition);
}

.result-item:hover {
    box-shadow: var(--shadow);
    transform: translateX(5px);
}

.result-item h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-item h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.result-item h3 a:hover {
    text-decoration: underline;
}

.result-item .breadcrumb {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.result-item .excerpt {
    color: #555;
    line-height: 1.6;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid var(--light-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Highlight Search Terms */
.highlight {
    background-color: #ffeb3b;
    font-weight: 600;
    padding: 0 0.2em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .menu-toggle {
        display: block;
        position: absolute;
        right: 20px;
        top: 20px;
    }

    nav {
        width: 100%;
        margin-top: 1rem;
    }

    nav ul {
        flex-direction: column;
        display: none;
        width: 100%;
    }

    nav ul.active {
        display: flex;
    }

    nav a {
        display: block;
        text-align: center;
    }

    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        order: 2;
    }

    .main-content {
        order: 1;
    }

    .chapters-grid {
        grid-template-columns: 1fr;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    header,
    footer,
    .sidebar,
    .search-container,
    nav,
    .menu-toggle {
        display: none !important;
    }

    .container {
        grid-template-columns: 1fr;
    }

    .main-content {
        box-shadow: none;
        padding: 0;
    }

    body {
        background: white;
    }

    a {
        color: inherit;
        text-decoration: none;
    }
}