:root {
    --primary-color: #00473e;
    --accent-color: #b9fbc0;
    --bg-color: #f9f9f9;
    --text-color: #333;
    --card-bg: #ffffff;
}

/* Smooth scrolling is handled by JavaScript to avoid conflicts with Webflow */
html {
    /* scroll-behavior: smooth; - Disabled to prevent conflicts */
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Header */
header {
    background: #fff;
    padding: 20px 40px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 40px;
}

header h1 {
    margin: 0;
    color: var(--primary-color);
}

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Alphabet Navigation Styles --- */
.alpha-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.alpha-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background-color: #fff;
    border: 1px solid #ddd;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.alpha-link:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.alpha-link.disabled {
    opacity: 0.4;
    cursor: default;
    background-color: #f0f0f0;
    border-color: #eee;
    pointer-events: none; /* Prevents clicking */
    box-shadow: none;
}

/* --- Back to Top Button --- */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0; /* Hidden by default */
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

#back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

#back-to-top:hover {
    background-color: #2e8b57;
    transform: translateY(-3px);
}

/* --- Layout Wrapper for Sidebar + Content --- */
.layout-wrapper {
    display: grid;
    /* Sidebar is 250px, Content takes the remaining space */
    grid-template-columns: 250px 1fr; 
    gap: 40px;
    margin-bottom: 60px;
}

/* Sidebar Styles */
.sidebar {
    display: block;
}

.toc-sticky {
    position: sticky;
    top: 20px;
    background: transparent;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.toc-header {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 15px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.toc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 2px solid #e0e0e0;
}

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

.toc-item a {
    display: block;
    padding: 8px 0 8px 20px;
    text-decoration: none;
    color: #666;
    font-size: 0.95rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
    margin-left: -2px;
}

.toc-item a:hover {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    background-color: rgba(0,0,0,0.02);
}

.toc-item.h3 a {
    padding-left: 35px;
    font-size: 0.9rem;
    color: #777;
}

/* Article Styles */
.article-container {
    background: white;
    padding: 60px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    min-width: 0;
}

.article-title {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 30px;
    line-height: 1.1;
    margin-top: 0;
}

.article-content {
    font-size: 1.2rem;
    color: #444;
}

.article-content h2 {
    color: var(--text-color);
    margin-top: 1.5em;
    font-size: 1.8rem;
    scroll-margin-top: 20px;
}

.article-content h3 {
    color: #555;
    margin-top: 1.5em;
    font-size: 1.4rem;
    scroll-margin-top: 20px;
}

.article-content p {
    margin-bottom: 1.2em;
}

/* Table Styling for Content */
.table {
    width:100%;
    border-collapse:collapse;
    border-spacing:0;
    background-color:#fff;
    border-radius:8px;
    overflow:hidden;
    box-shadow:0 2px 6px rgba(0,0,0,.04);
    margin-bottom: 20px;
}
.table thead{background-color:#f5f5f7}
.table thead tr{border-bottom:1px solid #e2e2e7}
.table th,.table td{padding:12px 16px;text-align:left;vertical-align:middle;border-bottom:1px solid #f0f0f3;font-size:14px}
.table th{font-weight:600;text-transform:none;letter-spacing:.01em;white-space:nowrap}
.table tbody tr:nth-child(even) {background-color:#fafafa}
.table tbody tr:hover{background-color:#f0f4ff}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    text-decoration: none;
    color: #666;
    font-weight: bold;
}

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

/* Landing Page Grid */
.glossary-section {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    padding: 30px 0;
    scroll-margin-top: 20px; /* Offset for smooth scroll landing */
}

/* Fix for Taxapedia glossary sections with tso- prefix */
.tso-glossary-section {
    scroll-margin-top: 100px; /* Offset to account for any header/nav */
}

.glossary-letter {
    flex: 0 0 100px;
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    padding-right: 20px;
}

.glossary-list {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.glossary-item a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.glossary-item a:hover {
    color: #2e8b57;
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .layout-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .toc-sticky {
        position: static;
        border: 1px solid #eee;
        padding: 15px;
        background: #fdfdfd;
        border-radius: 8px;
        max-height: none;
    }

    .article-container {
        padding: 30px;
    }
    
    .article-title {
        font-size: 2rem;
    }
    
    .glossary-section {
        flex-direction: column;
    }
    
    .glossary-letter {
        margin-bottom: 15px;
        border-bottom: 2px solid var(--accent-color);
        width: fit-content;
    }
    
    /* Make alphabet smaller on mobile */
    .alpha-link {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}