html, body {
    overscroll-behavior-y: none; 
}

:root {
    --primary-blue: #00509e;
    --text-dark: #222;
    --text-light: #555;
    --border-color: #e0e0e0;
    --bg-light: #f9f9f9;
    --ai-purple: #8a2be2;
    --ai-bg: #f5f0ff;
    --link-blue: #0056b3;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    margin: 0;
    padding: 0;
    background-color: white; /* Matches the html and footer */
    min-height: 100vh; /* Fallback */
    min-height: 100dvh; /* Adapts to iOS address bar */
    display: flex;
    flex-direction: column;
}


/* Header & Navigation */
.main-header {
    border-bottom: 1px solid var(--border-color);
    padding: 10px 15px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 100;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.hamburger-menu {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--primary-blue);
}

.logo {
    color: var(--primary-blue);
    font-size: 24px;
    font-weight: bold;
    letter-spacing: -0.5px;
}

.top-icons .icon {
    margin-left: 15px;
    font-size: 20px;
    cursor: pointer;
}

.search-container {
    width: 100%;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 5px 15px;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 14px;
    outline: none;
}

.ai-mode-btn {
    background: var(--ai-bg);
    color: var(--ai-purple);
    border: none;
    border-radius: 15px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Article Container */
.article-container {
    padding: 20px 15px;
    max-width: 800px;
    margin: 0 auto;
}

.article-meta-category a {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.article-title {
    font-family: var(--font-serif);
    font-size: 32px;
    line-height: 1.2;
    margin: 15px 0;
    font-weight: normal;
}

.article-author-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.author-name {
    font-size: 16px;
    color: var(--text-dark);
}

.author-flag {
    display: flex;
    align-items: center;
    font-weight: bold;
    color: var(--primary-blue);
    font-size: 18px;
}

.article-citation {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

/* Social Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.action-stats {
    display: flex;
    gap: 15px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.email-alert-btn {
    background: #fff;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

/* Article Body Typography */
.article-body {
    font-family: var(--font-sans);
    font-size: 17px;
    color: #333;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body a {
    color: var(--link-blue);
    text-decoration: none;
}

.article-body a:hover {
    text-decoration: underline;
}

.article-body h2 {
    font-family: var(--font-sans);
    font-size: 20px;
    margin: 25px 0 15px 0;
    color: #000;
}

.jump-link {
    display: inline-block;
    margin-bottom: 20px;
    font-weight: 600;
}
/* Key Points Box */
.key-points-box {
    background-color: #f7f9ff;
    border: 1px solid #d0d7f0;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
}

.key-points-box h3 {
    margin-bottom: 15px;
    font-size: 18px;
}

.key-points-box ul {
    padding-left: 20px;
    margin-bottom: 20px;
}

.key-points-box li {
    margin-bottom: 10px;
}

.ai-prompts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #d0d7f0;
    padding-top: 15px;
}

.ai-prompts a {
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
}

/* Floating AI Button */
.floating-ai-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #fff;
    border: 1px solid #e0d0ff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: var(--ai-purple);
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s ease;
}

.floating-ai-btn:hover {
    transform: scale(1.05);
}

/* Comments Section */
.comments-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.comments-section h3 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--primary-blue);
}

/* Comment Form */
.comment-form-box {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.comment-form-box h4 {
    margin-bottom: 15px;
    font-size: 16px;
}

.comment-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.btn-submit-comment {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

.btn-submit-comment:hover {
    background-color: #003a70;
}

/* Comment List */
.comment-bubble {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.comment-meta {
    margin-bottom: 8px;
}

.comment-date {
    color: var(--text-light);
    font-size: 13px;
    margin-left: 10px;
}

.comment-body {
    font-size: 15px;
    color: #444;
    line-height: 1.5;
}

.no-comments {
    color: gold;
    font-style: sans-serif;
}
.loading-text {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 20px 0;
}

/* --- Modal Overlay Base --- */
.comments-modal {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 9999;
    overflow-y: auto;
    font-family: var(--font-sans);
}

.comments-modal.show {
    display: block;
}

.comments-modal-content {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
}

/* --- Modal Header --- */
.comments-header {
    background-color: #31214a; /* Dark purple from screenshot */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.comments-header h2 {
    font-size: 18px;
    font-weight: normal;
    margin: 0;
    color: #fff;
}

.close-comments-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.comments-body {
    padding: 20px;
}

/* --- Login Prompt --- */
.login-prompt {
    border: 1px solid #e0e0e0;
    padding: 20px;
    text-align: center;
    font-size: 15px;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.5;
}

.login-prompt a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: bold;
}

/* --- Controls & Tabs --- */
.comments-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    padding-bottom: 0;
}

.comments-tab {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    padding-bottom: 10px;
    border-bottom: 3px solid transparent;
}

.comments-tab.active {
    color: #333;
    border-bottom-color: var(--primary-blue);
}

/* --- Dropdown Filter --- */
.custom-dropdown {
    position: relative;
}

.dropdown-toggle {
    background-color: #f0f4f8;
    color: var(--primary-blue);
    border: none;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #333;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 150px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 100;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu li {
    padding: 10px 15px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
}

.dropdown-menu li:hover {
    background-color: #f5f5f5;
}

.dropdown-menu li.active {
    background-color: #e6f0fa;
}

/* --- Comments List UI --- */
.comment-bubble {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-meta {
    margin-bottom: 5px;
    font-size: 15px;
}

.comment-author {
    color: #555;
}

.comment-date {
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
}

.comment-body {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
}