/* --- Global Reset & Box Sizing --- */
* {
    box-sizing: border-box;
}

html {
    overflow-y: auto; /* Only show vertical scrollbar when needed */
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* CSS Variables for Light Theme (Default) */
:root {
    --bg-primary: #f4f4f9;
    --bg-secondary: white;
    --text-primary: #333;
    --text-secondary: #666;
    --nav-bg: #002244;
    --nav-border: #003366;
    --card-bg: white;
    --card-border: #ddd;
    --card-border-blue: #0059b3;
    --button-primary: #0059b3;
    --button-primary-hover: #004080;
    --button-secondary: #0066cc;
    --button-secondary-hover: #0052a3;
    --link-color: #0066cc;
    --link-hover: #0052a3;
    --article-title: #003366;
    --shadow: rgba(0,0,0,0.1);
}

/* Dark Theme */
html.dark-theme,
body.dark-theme {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --nav-bg: #0a0a0a;
    --nav-border: #1a1a1a;
    --card-bg: #2d2d2d;
    --card-border: #404040;
    --card-border-blue: #0059b3;
    --button-primary: #0059b3;
    --button-primary-hover: #0077cc;
    --button-secondary: #0066cc;
    --button-secondary-hover: #0077cc;
    --link-color: #66b3ff;
    --link-hover: #99ccff;
    --article-title: #99ccff;
    --shadow: rgba(0,0,0,0.3);
}

/* General Body Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header and Navigation Styles */
header {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('../images/my-background.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    position: relative;
}

header h1 {
    margin: 0;
    font-size: 2.5em;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    /* New styles */
    background: linear-gradient(45deg, #ccc, #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent; /* Fallback */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    will-change: transform; /* Performance hint for the browser */
}

header h1:hover {
    transform: scale(1.02) translateZ(0); /* Smoother animation by promoting to a new layer */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

#about-button {
    position: static;
    background-color: #0059b3;
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: normal;
    transition: background-color 0.3s;
}

#about-button:hover {
    background-color: #004080;
}

#main-nav {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out, background-color 0.3s ease, border-color 0.3s ease;
    flex-wrap: wrap;
    justify-content: space-between;
    overflow-x: auto; /* Allow horizontal scroll on mobile if needed */
    overflow-y: hidden; /* Prevent vertical overflow */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

#category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-grow: 1;
    justify-content: center;
    min-width: 300px; /* Prevent shrinking too much */
}

#main-nav .nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: nowrap;
    margin-left: auto;
}

#main-nav .nav-actions > * {
    flex-shrink: 0;
}

#main-nav.nav-hidden {
    transform: translateY(-100%); /* Hides the nav bar upwards */
}

#main-nav button {
    background: none;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    white-space: nowrap;
    min-width: 80px;
    flex-shrink: 0;
    position: static;
    display: inline-block;
}

/* Exclude mobile menu toggle from general button styles */
#main-nav button.mobile-menu-toggle {
    min-width: auto;
    padding: 5px;
    background: transparent;
    display: none; /* Hidden by default, shown on mobile */
}

#register-button, #logout-button, #about-button {
    flex-shrink: 0;
    padding: 0.5rem 1.25rem;
    position: static;
    display: inline-block;
}

#register-button {
    background-color: #0066cc;
    border-radius: 5px;
}

#register-button:hover {
    background-color: #0052a3;
}

#logout-button {
    background-color: #d9534f;
    border-radius: 5px;
    border: none;
    color: white;
    transition: background-color 0.3s;
}

#logout-button:hover {
    background-color: #c9302c;
}

#about-button {
    background-color: #0059b3;
    border-radius: 5px;
}

#about-button:hover {
    background-color: #004080;
}

#main-nav button:hover, #main-nav button.active {
    background-color: #0059b3;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
    position: relative;
    flex-shrink: 0;
    align-items: center;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center;
    display: block;
    margin: 2px 0;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Main Content Styles */
main {
    padding: 2rem;
    flex: 1; /* Allows main to grow and fill available space */
    padding-bottom: 80px; /* Add padding to prevent footer overlap */
    background-color: var(--bg-primary);
    overflow-x: hidden; /* Prevent horizontal scrolling */
    transition: background-color 0.3s ease;
}

.breadcrumb-container {
    text-align: center; /* Center the inline-block child */
    margin-bottom: 1.5rem;
}

#current-category-title {
    /* margin-bottom is now on the container */
    font-size: 1.6em; /* Slightly smaller font size */
    color: #ddd;
    text-align: center;
    font-weight: 300;
    /* New styles for the container */
    padding: 0.75rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.05); /* Subtle background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; /* Rounded corners */
    display: inline-block; /* Fit content width */
    /* Centering margins are no longer needed here */
}

#current-category-title .breadcrumb-link {
    color: #00aaff;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

#current-category-title .breadcrumb-link:hover {
    color: #00eeff;
    text-decoration: underline;
}

#navigation-controls {
    margin-bottom: 1rem;
}

#back-button {
    position: absolute;
    left: 2rem;
    background-color: #0059b3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

#back-button:hover {
    background-color: #004080;
}

.hidden {
    display: none !important;
}

/* Registration Page */
body.register-body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.register-main {
    padding: 2rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    min-height: calc(100vh - 300px);
    align-items: center;
    padding-bottom: 4rem;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.registration-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--shadow);
    padding: 2.5rem;
    max-width: 480px;
    width: 100%;
    border: 1px solid var(--card-border);
    text-align: center;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.registration-icon {
    margin-bottom: 1.5rem;
}

.registration-icon i {
    font-size: 4rem;
    color: #4285F4;
    background: linear-gradient(135deg, #4285F4 0%, #34A853 50%, #FBBC05 75%, #EA4335 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.registration-card h2 {
    margin-bottom: 1rem;
    color: var(--article-title);
    font-size: 1.75rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.registration-card p.description {
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    transition: color 0.3s ease;
}

.registration-card form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.registration-card label {
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.registration-card input {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
    background-color: var(--card-bg);
    color: var(--text-primary);
}

.registration-card input:focus {
    border-color: var(--button-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
    outline: none;
}

.registration-card input:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.registration-card button[type="submit"] {
    background-color: #0066cc;
    color: #fff;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.registration-card button[type="submit"]:hover {
    background-color: #0052a3;
}

.form-message {
    margin: 1rem auto 0;
    max-width: 880px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    border: 1px solid transparent;
}

.form-message.info {
    background-color: #e8f1ff;
    border-color: #b5d2ff;
    color: #003c7a;
}

.form-message.success {
    background-color: #e7f6ec;
    border-color: #b5e5c9;
    color: #1b5e20;
}

.form-message.error {
    background-color: #ffeceb;
    border-color: #ffc7c2;
    color: #b71c1c;
}

.error-message {
    background-color: #ffeceb;
    border: 2px solid #ffc7c2;
    color: #b71c1c;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.6;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body.dark-theme .error-message {
    background-color: #4a1f1f;
    border-color: #6b2a2a;
    color: #ffcccc;
}

.error-message i {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.error-message strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.error-message.hidden {
    display: none;
}

.register-helper {
    font-size: 0.9rem;
    color: #627089;
}

.google-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: #4285F4;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
    margin: 0 auto 2rem auto;
    width: 100%;
    max-width: 300px;
}

.google-button:hover {
    background-color: #357AE8;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
    transform: translateY(-2px);
}

.google-button i {
    font-size: 1.25rem;
}

.google-button span {
    font-size: 1rem;
}

.registration-benefits {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    transition: border-color 0.3s ease;
}

.benefit-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.benefit-item i {
    color: #34A853;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.link-button {
    background: none;
    border: none;
    color: #0066cc;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
    margin: 0;
}

.link-button:hover {
    color: #0052a3;
}

.register-nav {
    background-color: var(--nav-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--nav-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.register-nav button {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.register-nav button:hover {
    background-color: var(--button-primary);
}

.register-heading {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
}

.register-nav #theme-toggle-button {
    background-color: var(--button-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.register-nav #theme-toggle-button:hover {
    background-color: var(--button-primary-hover);
}

.register-nav #theme-toggle-button .theme-icon {
    width: 1.1rem;
    height: 1.1rem;
    display: inline-block;
    vertical-align: middle;
}

/* Categories Section */
#categories-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.category-tile {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.5rem;
    width: 200px;
    text-align: center;
    cursor: pointer;
    transition: box-shadow 0.3s, transform 0.3s, background-color 0.3s ease, border-color 0.3s ease;
    color: var(--text-primary);
}

.category-tile:hover {
    box-shadow: 0 4px 8px var(--shadow);
    transform: translateY(-5px);
}

.category-tile img {
    max-width: 100%;
    height: auto;
    margin-bottom: 1rem;
    border-radius: 5px;
}

/* Articles Section */
#articles-container {
    margin: 2rem auto 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1200px; /* Or another value that fits your design */
}

.article-tile {
    background-color: white;
    border: 1px solid var(--card-border-blue);
    border-radius: 8px;
    padding: 1.5rem;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s ease;
    text-decoration: none;
    color: #333;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.article-tile:hover {
    box-shadow: 0 4px 8px var(--shadow);
    transform: translateY(-5px);
}

.article-details {
    flex-grow: 1;
}

.article-tile h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #003366;
}

.article-tile .article-summary-full {
    display: none;
}

.article-summary-short, .article-summary-full {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-top: 0.5rem;
    color: #333;
}

.expand-abstract {
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 0.5rem;
    background-color: #0059b3;
    padding: 8px 12px;
    border-radius: 5px;
}

.expand-abstract:hover {
    background-color: #004080;
}

.article-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

/* Star Rating Styles */
.ratings-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e8e8e8;
}

.star-rating-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.star-rating {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

.star {
    font-size: 1.5rem;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    line-height: 1;
}

.star.filled {
    color: #ffd700;
    text-shadow: 0 1px 2px rgba(255, 215, 0, 0.3);
}

.star.half-filled {
    background: linear-gradient(90deg, #ffd700 50%, #ddd 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.star.hover-filled {
    color: #ffd700;
    transform: scale(1.1);
}

.star:hover {
    transform: scale(1.15);
    color: #ffd700;
}

.star:active {
    transform: scale(0.95);
}

.rating-text {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.your-rating {
    font-size: 0.85rem;
    color: #0059b3;
    margin-left: 0.5rem;
    font-weight: 600;
}

.login-prompt {
    font-size: 0.85rem;
    color: #666;
    margin-left: 0.5rem;
    font-style: italic;
}

/* Disable interaction for non-logged-in users */
.star-rating:not(.interactive) .star {
    cursor: default;
    pointer-events: none;
}

.star-rating:not(.interactive) .star:hover {
    transform: none;
    color: inherit;
}

.pdf-link {
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 0.5rem;
    background-color: #0059b3;
    padding: 8px 12px;
    border-radius: 5px;
}

.pdf-link:hover {
    background-color: #004080;
}

.pdf-link i {
    margin-right: 0.25rem;
}

.arxiv-link {
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 0.5rem;
    background-color: #0059b3;
    padding: 8px 12px;
    border-radius: 5px;
}

.arxiv-link:hover {
    background-color: #004080;
}

.ask-question-btn {
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 0.5rem;
    background-color: #0059b3;
    padding: 8px 12px;
    border-radius: 5px;
}

.ask-question-btn:hover {
    background-color: #004080;
}

.favorite-btn {
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 0.5rem;
    background-color: #0059b3;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.favorite-btn:hover {
    background-color: #004080;
}

.favorite-btn.favorited {
    background-color: #e91e63;
}

.favorite-btn.favorited:hover {
    background-color: #c2185b;
}

.favorite-btn i {
    margin-right: 0.25rem;
}

/* Loader Styles */
#loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #003366;
    z-index: 1000;
}

.spinner {
    border: 8px solid #f3f3f3; /* Light grey */
    border-top: 8px solid #0059b3; /* Blue */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
    margin: 0 auto 1rem auto;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 2.5rem;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    position: relative;
    border: 2px solid var(--button-primary);
    box-shadow: 0 5px 15px var(--shadow);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.modal-content p {
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.close-button {
    color: var(--text-secondary);
    float: right;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

/* --- Donate Modal Specific Styles --- */
.wallet-info {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--card-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.wallet-info hr {
    border: none;
    border-top: 1px solid #ccc;
    margin: 1rem 0;
}

.wallet-info p {
    font-size: 1em;
    margin: 0.5rem 0;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.wallet-address {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    flex-wrap: wrap; /* For mobile */
}

.wallet-address p {
    word-break: break-all; /* Ensure long address wraps */
    margin-right: 1rem; /* Space between address and button */
}

#copy-wallet-button,
#copy-wallet-button-tron,
#copy-wallet-button-bsc {
    background-color: #0059b3;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

#copy-wallet-button:hover,
#copy-wallet-button-tron:hover,
#copy-wallet-button-bsc:hover {
    background-color: #004080;
}

.thank-you-message {
    margin-top: 1.5rem;
    text-align: center;
    font-style: italic;
    color: #555;
}

/* Footer Styles */
footer {
    background-color: var(--nav-bg);
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    border-top: 1px solid var(--nav-border);
    /* New styles for static footer */
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.donate-button {
    background-color: #0059b3;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: normal;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.donate-button:hover {
    background-color: #004080;
}

.contact-button {
    background-color: #0059b3;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: normal;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
}

.contact-button:hover {
    background-color: #004080;
}

/* --- Contact Modal Specific Styles --- */
.contact-info {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--card-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.contact-info p {
    font-size: 1em;
    margin: 0.5rem 0;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.email-address {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.email-address p {
    word-break: break-all;
    margin-right: 1rem;
}

#copy-email-button {
    background-color: #0059b3;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

#copy-email-button:hover {
    background-color: #004080;
}

/* Theme Toggle Button */
#theme-toggle-button {
    background-color: var(--button-primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#theme-toggle-button:hover {
    background-color: var(--button-primary-hover);
}

#theme-toggle-button .theme-icon {
    width: 1.1rem;
    height: 1.1rem;
    display: inline-block;
    vertical-align: middle;
}

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

/* Responsive Design */
@media (max-width: 1000px) {
    #main-nav {
        justify-content: center;
    }

    #category-buttons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    #main-nav {
        flex-wrap: wrap;
    }

    #category-buttons {
        width: 100%;
        order: 99; /* Ensure it's last */
        justify-content: flex-start;
        overflow-x: auto;
    }
}

.article {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.article h3 {
    margin-top: 0;
}

.article-meta {
    font-size: 0.8rem;
    color: #333;
    font-weight: bold;
    text-align: right;
    margin-left: 1rem;
    flex-shrink: 0;
}

.article-authors {
    font-size: 0.9rem;
    font-style: italic;
    color: #555;
    margin-bottom: 1rem;
}

.article-details hr {
    border: 0;
    border-top: 1px solid #0059b3;
    margin: 1rem 0;
}

.ratings-section, .comments-section {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.comment {
    margin-bottom: 10px;
    padding: 5px;
    background-color: #f9f9f9;
    border-left: 3px solid #ccc;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        font-size: 14px; /* Adjust base font size for mobile */
    }

    header h1 {
        font-size: 2em; /* Reverted */
        text-align: center;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: flex !important;
        order: 10; /* Position it at the end */
        margin-left: auto;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure mobile menu toggle is visible and properly sized */
    #main-nav button.mobile-menu-toggle {
        min-width: 30px;
        width: 30px;
        height: 30px;
        padding: 5px;
        display: flex !important;
    }

    #main-nav .nav-actions {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--nav-bg);
        border-bottom: 1px solid var(--nav-border);
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        margin-left: 0;
        z-index: 1000;
    }

    #main-nav .nav-actions.mobile-menu-open {
        display: flex;
    }

    #main-nav .nav-actions button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    #main-nav button {
        padding: 0.6rem 1rem;
        font-size: 0.9em;
    }

    main {
        padding: 1rem;
        padding-bottom: 150px; /* More padding for taller footer */
    }

    #current-category-title {
        font-size: 1.2em;
        padding: 0.5rem 1rem;
        width: 90%;
    }

    .category-tile {
        flex-basis: 100%; /* Single column layout */
    }

    .article-tile {
        flex-direction: column;
        padding: 1rem;
    }

    .article-details {
        padding-right: 0;
    }

    .article-meta {
        padding-left: 0;
        margin-top: 1rem;
        text-align: left;
    }

    .modal-content {
        width: 95%;
        margin: 25% auto;
        padding: 1.5rem;
        font-size: 1em;
    }

    footer {
        padding: 1rem;
    }

    .footer-content {
        flex-direction: column;
    }

    .footer-content p,
    .footer-content .social-links {
        margin-bottom: 0.8rem;
    }

    .register-nav {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .register-main {
        padding: 1.5rem 1rem;
    }

    .registration-card {
        padding: 1.5rem;
    }

    .form-message {
        width: 90%;
    }
}

/* Article Detail Page Styles */
.article-header-fixed {
    position: sticky;
    top: 0;
    z-index: 999;
    background: linear-gradient(135deg, var(--nav-bg) 0%, var(--nav-border) 100%);
    border-bottom: 3px solid var(--button-primary);
    padding: 2rem;
    box-shadow: 0 4px 12px var(--shadow);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.article-header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.article-header-content h2 {
    color: white;
    margin: 0 0 1rem 0;
    font-size: 1.75rem;
    line-height: 1.4;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.article-header-meta {
    color: #e0e0e0;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    line-height: 1.6;
}

.article-header-meta .separator {
    color: #888;
    font-weight: 300;
}

.article-header-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.article-rating-container {
    display: flex;
    align-items: center;
    margin-right: auto;
}

.article-rating-container .star-rating-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-rating-container .star-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.article-rating-container .star {
    color: #ddd;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.article-rating-container .star.filled {
    color: #ffc107;
}

.article-rating-container .star.half-filled {
    background: linear-gradient(90deg, #ffc107 50%, #ddd 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.article-rating-container .star.interactive:hover,
.article-rating-container .star.highlighted {
    color: #ffc107;
}

.article-rating-container .rating-text {
    font-size: 0.9rem;
    color: #e0e0e0;
    margin-left: 0.5rem;
}

.article-rating-container .your-rating {
    font-size: 0.85rem;
    color: #aaa;
}

.article-rating-container .login-prompt {
    font-size: 0.85rem;
    color: #aaa;
    margin-left: 0.5rem;
}

.header-action-button {
    background: linear-gradient(135deg, #0059b3 0%, #004080 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-action-button:hover {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.article-detail-main {
    padding: 2rem 0;
    max-width: 100%;
    margin: 0;
    padding-bottom: 150px;
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.article-section {
    background-color: white;
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--card-border);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

body.dark-theme .article-section {
    background-color: var(--card-bg);
    border-color: var(--card-border);
}

/* Make article section containing chat section full width - break out of container */
.article-section.chat-section {
    padding: 0;
    width: 80%;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    border-radius: 0;
    box-shadow: none;
    border: none;
    position: relative;
    background-color: transparent !important; /* Override white background */
}

body.dark-theme .article-section.chat-section {
    background-color: transparent !important;
    border: none !important;
}

/* Hide abstract section on discussion page */
#article-summary-section {
    display: none;
}

.article-section h3 {
    color: var(--article-title);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 600;
    border-bottom: 3px solid var(--button-primary);
    padding-bottom: 0.75rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.article-content {
    color: #333;
    line-height: 1.9;
    font-size: 1.05rem;
    text-align: justify;
    font-family: 'Georgia', 'Times New Roman', serif;
}

.form-container {
    margin-bottom: 2rem;
}

.form-container textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 1rem;
    background-color: var(--card-bg);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.form-container textarea:focus {
    outline: none;
    border-color: var(--button-primary);
    box-shadow: 0 0 0 3px rgba(0, 89, 179, 0.1);
}

.submit-button {
    background-color: #0059b3;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-button:hover {
    background-color: #004080;
}

.submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.questions-list, .comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.question-item, .comment-item {
    background-color: #f9f9f9;
    border-left: 4px solid var(--button-primary);
    padding: 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.dark-theme .question-item,
body.dark-theme .comment-item {
    background-color: var(--card-bg);
}

.question-date, .comment-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.question-content, .comment-content {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    transition: color 0.3s ease;
}

.question-header, .comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-badge {
    background-color: var(--button-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.empty-message {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
    transition: color 0.3s ease;
}

.form-message.hidden {
    display: none;
}

.form-message.success {
    background-color: #e7f6ec;
    border-color: #b5e5c9;
    color: #1b5e20;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid;
}

.form-message.error {
    background-color: #ffeceb;
    border-color: #ffc7c2;
    color: #b71c1c;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid;
}

/* Chat-Style Comments */
.chat-section {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 500px); /* Further reduced height to make input more visible */
    max-height: none;
    width: 100%;
    max-width: 100%;
    min-height: 300px; /* Further reduced min-height */
    margin-bottom: 2rem; /* Add margin to ensure input is visible */
    border: none; /* Ensure no border */
    background-color: transparent; /* Let child elements handle background */
}

body.dark-theme .chat-section {
    background-color: transparent;
    border: none;
}

.chat-section h3 {
    padding: 1.5rem 2rem;
    margin: 0;
    border-bottom: 1px solid var(--card-border);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: background-color 0.3s ease;
    max-width: 100%;
    width: 100%;
    padding-bottom: 1rem; /* Add padding to prevent content from being hidden behind input */
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-own {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}

.chat-message-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0059b3 0%, #004080 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(0, 89, 179, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.chat-message-own .avatar-circle {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-message-content {
    flex: 1;
    background-color: white;
    border-radius: 16px;
    padding: 0.875rem 1.125rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    transition: box-shadow 0.2s;
}

.chat-message-content:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.chat-message-own .chat-message-content {
    background: linear-gradient(135deg, #0059b3 0%, #004080 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 89, 179, 0.4);
}

.chat-message-own .chat-message-content:hover {
    box-shadow: 0 4px 10px rgba(0, 89, 179, 0.5);
}

.chat-message-content {
    flex: 1;
    background-color: white;
    border-radius: 16px;
    padding: 0.875rem 1.125rem;
    box-shadow: 0 2px 4px var(--shadow);
    border: 1px solid var(--card-border);
    transition: box-shadow 0.2s, border-color 0.3s ease;
    color: #333;
}

.chat-message-content:hover {
    box-shadow: 0 4px 8px var(--shadow);
}

.chat-message-own .chat-message-content {
    background: linear-gradient(135deg, #0059b3 0%, #004080 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 89, 179, 0.4);
}

.chat-message-own .chat-message-content:hover {
    box-shadow: 0 4px 10px rgba(0, 89, 179, 0.5);
}

.chat-message-position {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-left: 0.5rem;
    transition: color 0.3s ease;
}

.chat-message-author {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--button-primary);
    letter-spacing: 0.01em;
    transition: color 0.3s ease;
}

.chat-message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 400;
    transition: color 0.3s ease;
}

.chat-message-own .chat-message-author {
    color: rgba(255, 255, 255, 0.95);
}

.chat-message-own .chat-message-position {
    color: rgba(255, 255, 255, 0.7);
}

.chat-message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 400;
    transition: color 0.3s ease;
}

.chat-message-own .chat-message-time {
    color: rgba(255, 255, 255, 0.75);
}

.chat-message-text {
    color: #333;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.chat-message-text .MathJax,
.chat-message-text .MathJax_Display {
    display: inline !important;
    margin: 0 !important;
}

.chat-message-own .chat-message-text {
    color: rgba(255, 255, 255, 0.98);
}

.chat-empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
    transition: color 0.3s ease;
}

.chat-empty-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.chat-empty-message p {
    font-size: 1.1rem;
    margin: 0;
}

.chat-input-container {
    padding: 1.5rem 2rem;
    background-color: white;
    border-top: 1px solid var(--card-border);
    border-bottom: none; /* Remove any bottom border */
    transition: background-color 0.3s ease, border-color 0.3s ease;
    width: 100%;
    margin-top: auto;
    position: sticky;
    bottom: 4rem; /* Move up from bottom by 4rem for better visibility */
    z-index: 10;
    margin-bottom: 0; /* Remove bottom margin to prevent white line */
}

body.dark-theme .chat-input-container {
    background-color: var(--card-bg);
    border-top-color: var(--card-border);
    border-bottom: none; /* Ensure no bottom border in dark mode */
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input-wrapper textarea {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--card-border);
    border-radius: 24px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s ease, color 0.3s ease;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.chat-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--button-primary);
    box-shadow: 0 0 0 3px rgba(0, 89, 179, 0.1);
    background-color: var(--card-bg);
}

.chat-send-button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0059b3 0%, #004080 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 3px 6px rgba(0, 89, 179, 0.3);
    font-size: 1.1rem;
}

.chat-send-button:hover {
    transform: scale(1.08);
    box-shadow: 0 5px 12px rgba(0, 89, 179, 0.4);
}

.chat-send-button:active {
    transform: scale(0.95);
}

.chat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-input-container .form-message {
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .chat-section {
        height: 500px;
        max-height: 60vh;
    }

    .chat-message {
        max-width: 85%;
    }

    .chat-container {
        padding: 1rem;
    }

    .chat-input-container {
        padding: 0.75rem 1rem;
    }

    .chat-section h3 {
        padding: 1rem 1.5rem;
    }
}
                                                                                                                                                                                        