/* =================================================================== */
/* Your Website's Main Styles */
/* =================================================================== */

/* CSS Reset for consistency */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Variables */
:root {
    --declarative-color: #2980b9; /* Contrast on white: 4.91:1 (Good) */
    --interrogative-color: #8e44ad; /* Contrast on white: 4.86:1 (Good) */
    --imperative-color: #A93226; /* Original: #c0392b. Contrast on white: 4.81:1 (Good) */
    --exclamatory-color: #B94A00; /* Original: #d35400. Contrast on white: 5.0:1 (Good) */
    --border-color: #ddd;
    --hover-color: #e8f4f8;
    --even-row-color: #f2f2f2;
    --header-bg: #0056b3; /* Original: #3498db. White text on this: 4.7:1 (Good) */
    --header-bg-hover: #00448a; /* Darker version for hover states */
    --sidebar-bg: #f8f8f8;
    --menu-bg: #2c3e50;
    --menu-hover: #34495e;
    --menu-text: #ffffff; /* Contrast with --menu-bg: 11.15:1 (Excellent) */
    --new-link-color: #0056b3; /* Original: #337aff. Contrast on #fff: 6.06:1 (Good), on #f8f9fa: 5.92:1 (Good) */
    --new-link-hover-color: #00448a; /* Darker shade for hover */
    --quick-links-main-color: #343a40; /* Contrast on #f8f9fa: 10.36:1 (Excellent) */
    --quick-links-hover-color: #0069d9; /* Original: #007bff. Contrast on #f8f9fa: 5.05:1 (Good) */
    --quick-links-sub-color: #495057; /* Contrast on #f8f9fa: 7.65:1 (Good) */

    /* Button specific colors */
    --print-btn-bg: #2E7D32; /* Original: #4CAF50. White text on this: 4.83:1 (Good) */
    --print-btn-hover-bg: #1B5E20;
    --share-btn-bg: #0069d9; /* Original: #007bff. White text on this: 4.54:1 (Good) */
    --share-btn-hover-bg: #005cbf;
    --download-btn-bg: #28a745; /* White text on this: 4.57:1 (Good) */
    --download-btn-hover-bg: #218838; /* Darker Green for hover */
    
    /* Lightbox colors */
    --lightbox-link-color: #8e44ad;
    --lightbox-link-hover-color: #6c3483;

    /* Rating system colors */
    --success-bg: #d4edda;
    --success-text: #155724;
    --success-border: #c3e6cb;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --error-border: #f5c6cb;
    --star-selected-color: #ffc107;
    --star-default-color: #e0e0e0;
}

/* General Body and Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: var(--sidebar-bg);
}

a {
    color: var(--new-link-color);
    text-decoration: none;
}

a:hover {
    color: var(--new-link-hover-color);
    text-decoration: none;
}

header {
    margin-bottom: 30px;
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin: 0 0 15px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--header-bg);
    font-size: 2rem;
}

h2 {
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.intro {
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.answer-content.hidden {
  display: none;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Top Navigation Menu */
.top-nav {
    background-color: var(--menu-bg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: relative;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    color: var(--menu-text);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 15px 0;
}

.logo:hover {
    color: var(--menu-text);
}

.logo img {
    height: 35px;
    margin-right: 10px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--menu-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

.main-menu {
    display: flex;
    margin: 0;
    padding: 0;
    list-style-type: none;
}

.main-menu > li {
    position: relative;
}

.main-menu > li > a {
    display: block;
    color: var(--menu-text);
    text-decoration: none;
    padding: 15px;
    transition: background-color 0.3s;
}

.main-menu > li:hover > a {
    background-color: var(--menu-hover);
}

/* Dropdown Menus */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 220px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s, visibility 0s 0.3s;
    z-index: 100;
    border-radius: 0 0 4px 4px;
    max-height: 500px; /* Sets the maximum height before scrolling begins */
    overflow-y: auto;  /* Adds a scrollbar only when the content overflows */
}

.main-menu > li:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.3s, transform 0.3s;
}

.dropdown li {
    list-style-type: none;
}

.dropdown a {
    display: block;
    color: var(--new-link-color);
    text-decoration: none;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

.dropdown a:hover {
    background-color: var(--hover-color);
    color: var(--new-link-hover-color);
    text-decoration: none;
}

/* Page Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-wrapper {
    display: flex;
    gap: 20px;
}

.main-content {
    flex: 1;
    background-color: white;
    padding: 25px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 5px;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    padding: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 5px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    margin-top: 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--header-bg);
    font-size: 1.2rem;
}

.popular-topics li {
    margin-bottom: 8px;
}

/* Ad Units */
.ad-unit {
    background-color: white;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    border: 1px solid #ddd;
}

.ad-unit h4 {
    margin-top: 0;
    color: #595959;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.ad-placeholder {
    background-color: #eee;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #505050;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* Featured Resource */
.featured-resource {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    border: 1px solid #ddd;
}

.featured-resource h4 {
    margin-top: 0;
    color: #2c3e50;
}

/* Newsletter Form */
.newsletter-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.newsletter-form button {
    background-color: var(--header-bg);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s ease;
}

.newsletter-form button:hover {
    background-color: var(--header-bg-hover);
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.legend-color {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 3px;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

caption {
    font-weight: bold;
    padding: 10px;
    background-color: #f9f9f9;
    caption-side: top;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    text-align: left;
}

th {
    background-color: var(--header-bg);
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

tr:nth-child(even) {
    background-color: var(--even-row-color);
}

tr:hover {
    background-color: var(--hover-color);
}

/* Text Color Utilities */
.declarative { color: var(--declarative-color); }
.interrogative { color: var(--interrogative-color); }
.imperative { color: var(--imperative-color); }
.exclamatory { color: var(--exclamatory-color); }

/* Info Box */
.info {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    border-left: 4px solid var(--header-bg);
}

.info ul {
    padding-left: 20px;
}

.info li {
    margin-bottom: 10px;
}

/* Call to Action (CTA) */
.cta-section,
.cta-exercise {
    text-align: center;
    padding: 10px;
    background-color: #e8f4f8;
    border-radius: 5px;
    margin: 10px 0;
}

.cta-section {
    margin: 30px 0;
    padding: 20px;
}

.cta-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--header-bg);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}
.cta-button:hover {
    background-color: var(--header-bg-hover);
}

/* =================================================================== */
/* Promo Box Section */
/* =================================================================== */
.promo-box-section {
    background: #2777ae;
    border-radius: 10px;
    padding: 10px 10px;
    text-align: center;
    color: #ffffff;
    margin: 40px 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.promo-box-section h2 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 15px;
    color: #ffffff;
}

.promo-box-section p {
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 650px;
    margin: 0 auto 25px auto;
}

.promo-box-button {
    display: inline-block;
    background-color: #f39c12;
    color: #000000;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.promo-box-button:hover {
    background-color: #e68e00;
    transform: translateY(-2px);
    color: #ffffff;
}


/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #ddd;
    color: #495057;
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.breadcrumbs a {
    color: var(--new-link-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: var(--new-link-hover-color);
    text-decoration: none;
}

/* Related Content */
.related-content {
    margin-top: 40px;
}

.related-content h3 {
    color: #2c3e50;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.related-content ul {
    padding-left: 20px;
}

.related-content li {
    margin-bottom: 8px;
}

/* Feature Image */
.feature-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 25px auto;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.image-container {
    text-align: center;
    margin: 25px 0;
}

.image-caption {
    font-size: 0.9rem;
    color: #595959;
    margin-top: 10px;
    text-align: center;
}

/* Image Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 10px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

.gallery-caption h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.gallery-caption p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.gallery-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.filter-btn {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--header-bg);
    color: white;
    border-color: var(--header-bg);
}

/* --- Quick Links / TOC (Corrected) --- */
.quick-links-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.quick-links-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #0056b3;
    font-size: 1.4em;
    border-bottom: 2px solid #0056b3;
    padding-bottom: 5px;
}
.quick-links-section ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
}
.quick-links-section ul li {
    margin-bottom: 10px;
}
.quick-links-section ul li a {
    color: var(--quick-links-main-color);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}
.quick-links-section ul li a:hover {
    color: var(--quick-links-hover-color);
    text-decoration: underline;
}
.quick-links-section ul ul {
    padding-left: 20px;
    margin-top: 8px;
}
.quick-links-section ul ul li {
    margin-bottom: 6px;
}
.quick-links-section ul ul li a {
    font-weight: normal;
    color: var(--quick-links-sub-color);
    text-decoration: none;
}
.quick-links-section ul ul li a:hover {
    color: var(--quick-links-hover-color);
    text-decoration: underline;
}

/* "Go to Quick Links" Button */
#goToQuickLinksBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background-color: #0056b3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    text-align: center;
    line-height: 50px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

#goToQuickLinksBtn:hover {
    background-color: #00448a;
}

/* Action Buttons (Print, Share, Download) & Worksheet Controls */
.action-buttons {
    margin: 10px 0 15px;
}

.print-button {
    display: inline-block;
    padding: 8px 15px;
    margin-right: 10px;
    background-color: var(--print-btn-bg);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    transition: background-color 0.3s ease;
}

.print-button:hover {
    background-color: var(--print-btn-hover-bg);
}

.share-button {
    display: inline-block;
    padding: 8px 15px;
    margin-right: 10px;
    background-color: var(--share-btn-bg);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    transition: background-color 0.3s ease;
}

.share-button:hover {
    background-color: var(--share-btn-hover-bg);
}

.download-image-btn {
    background-color: var(--print-btn-bg);
    border: none;
    color: white;
    padding: 8px 16px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1em;
    margin-left: 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    vertical-align: middle;
    line-height: 1.5; /* Add this line */
}

.download-image-btn:hover {
    background-color: var(--download-btn-hover-bg);
    color: white;
}

.worksheet-controls {
    margin-top: 10px;
    margin-bottom: 5px;
}

/* Show Answer Functionality */
.show-answer-btn {
    background-color: var(--share-btn-bg);
    border: none;
    color: white;
    padding: 8px 16px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    vertical-align: middle;
    line-height: 1.5; /* Add this line */
}

.show-answer-btn:hover {
    background-color: var(--share-btn-hover-bg);
}

.answer-content {
    margin-top: 5px;
    padding: 10px;
    border: 1px solid #ced4da;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-style: italic;
}

.answer-content small {
    font-style: normal;
}

.exercise-answers {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.exercise-answers ul {
    list-style-type: none;
    padding-left: 0;
}

.exercise-answers li {
    margin-bottom: 8px;
}

.exercise-answers strong {
    font-weight: bold;
}

/* Lightbox (Modal for Definitions) */
.lightbox-trigger {
    cursor: pointer;
    color: var(--lightbox-link-color);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    font-weight: bold;
}

.lightbox-trigger:hover {
    color: var(--lightbox-link-hover-color);
    text-decoration: none;
}

.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    padding-top: 60px;
}

.lightbox-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    animation-name: animatetop;
    animation-duration: 0.4s;
}

@keyframes animatetop {
  from {top: -300px; opacity: 0}
  to {top: 0; opacity: 1}
}

.lightbox-close {
    color: #777;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

#lightboxWord {
    margin-top: 0;
    color: #333;
}

#lightboxDefinition {
    font-size: 1em;
    color: #444;
    line-height: 1.6;
}

/* Print-Specific Footer Info (Initially Hidden) */
.print-footer-info {
    display: none;
}

/* Load More Button Styles */
.load-more-container {
    text-align: center;
    margin: 40px 0;
    transition: opacity 0.5s ease;
}

.load-more-btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: var(--header-bg);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
}

.load-more-btn:hover {
    background-color: var(--header-bg-hover);
}

.down-arrow-container {
    margin-top: 15px;
}

.down-arrow {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--header-bg);
    margin: 0 auto;
    animation: bounce 2s infinite;
}

#more-content {
    display: none;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px);
    }
    60% {
        transform: translateY(-7px);
    }
}

/* New Section for Other Collective Nouns */
.page-end-grid-container {
    background-color: var(--sidebar-bg, #f8f8f8);
    border-radius: 8px;
    padding: 2rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color, #ddd);
}
.page-end-grid-container h2 {
    text-align: center;
    color: var(--header-bg, #0056b3);
    margin-bottom: 0.5rem;
}
 .page-end-grid-container p {
    text-align: center;
    color: #555;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}
.page-end-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}
.page-end-link {
    display: block;
    padding: 0.8rem 1rem;
    background-color: var(--hover-color, #e8f4f8);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    text-align: center;
    text-decoration: none !important;
    color: var(--new-link-color, #0056b3) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.page-end-link:hover {
    background-color: var(--header-bg, #0056b3);
    border-color: var(--header-bg-hover, #00448a);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    color: var(--menu-text, #ffffff) !important;
}

/* Styling for the simple footer counter */
.footer-page-counter {
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    color: #495057;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.page-view-count {
    font-weight: bold;
    display: inline-block;
    min-width: 10px;
}

.loading {
    animation: subtle-pulse 1.5s ease-in-out infinite;
}

@keyframes subtle-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    .page-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        margin-top: 20px;
    }
    th, td {
        padding: 8px;
    }
    h1 {
        font-size: 1.8rem;
    }
    .legend {
        flex-direction: column;
        align-items: flex-start;
    }
    .info li {
        margin-bottom: 15px;
    }

    .promo-box-section {
        padding: 40px 20px;
    }

    .promo-box-section h2 {
        font-size: 1.8rem;
    }

    .promo-box-section p {
        font-size: 1rem;
    }

    .promo-box-button {
        padding: 10px 25px;
        font-size: 1rem;
    }

    .menu-toggle {
        display: block;
    }
    .main-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--menu-bg);
        box-shadow: 0 5px 5px rgba(0,0,0,0.2);
        z-index: 99;
    }
    .main-menu.active {
        display: flex;
    }
    .main-menu .dropdown {
        position: static;
        width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        display: none;
        background-color: var(--menu-hover);
    }
    .main-menu .dropdown.active {
        display: block;
    }
    .main-menu .dropdown a {
        padding-left: 30px;
        color: var(--menu-text);
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .main-menu .dropdown a {
    padding-left: 30px;
    color: #ffffff !important; /* Forces the link text to be white */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s ease;
}

.main-menu .dropdown a:hover {
    background-color: var(--menu-bg); /* Changes background on hover for better feedback */
}
    .menu-item-has-children > a:after {
        content: "▼";
        margin-left: 8px;
        font-size: 0.8em;
    }
     .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Center worksheet buttons on mobile and add spacing */
    .worksheet-controls {
        text-align: center;
    }
    .show-answer-btn {
        margin-bottom: 10px; /* Adds gap below the 'Show Answer' button */
    }
    .download-image-btn {
        margin-bottom: 10px; /* Adds gap below the 'Download' button */
    }
    .download-image-btn {
        margin-left: 0; /* Resets desktop margin for proper centering on mobile */
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    .gallery-filter {
        flex-direction: column;
        align-items: center;
    }
}


/* =================================================================== */
/* Rating System Styles (Consolidated) */
/* =================================================================== */

.rating-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
}

.rating-container {
    background-color: white;
    padding: 25px 40px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    border: 1px solid var(--border-color);
    margin: 40px auto;
}

.stars-wrapper {
    font-size: 3rem;
    color: var(--star-default-color);
    cursor: pointer;
    margin-bottom: 15px;
    display: inline-block;
}

.star {
    transition: color 0.2s ease-in-out;
}

.stars-wrapper:hover .star {
    color: var(--star-default-color); 
}

.stars-wrapper .star:hover,
.stars-wrapper .star.hovered {
    color: var(--star-selected-color) !important;
}

.stars-wrapper.selected .star.active {
    color: var(--star-selected-color); 
}

.stars-wrapper.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.rating-summary {
    font-size: 1rem;
    color: #555;
    margin-bottom: 20px;
}

#average-rating, #total-votes {
    font-weight: 600;
}

.message-box {
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-top: 20px;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

.message-box.success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.message-box.error {
    background-color: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.message-box.hidden {
    opacity: 0;
    display: none;
}


/* =================================================================== */
/* Print Styles */
/* =================================================================== */

@media print {
    body {
        background-color: white !important;
        color: black !important;
        margin: 1cm !important;
        padding: 0 !important;
        font-size: 12pt;
    }
    a {
        color: black !important;
        text-decoration: none !important;
    }
    a[href^="http"]:after,
    a[href^="https"]:after {
        content: " (" attr(href) ")";
        font-size: 90%;
    }
    .lightbox-trigger {
        color: black !important;
    }
    .quick-links-section a, .quick-links-section a:hover {
        color: black !important;
        text-decoration: none !important;
    }
    .declarative, .interrogative, .imperative, .exclamatory {
        color: black !important;
    }


    .container {
        max-width: 100% !important;
        padding: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    header, footer, .sidebar, .top-nav, .menu-toggle, .gallery-filter,
    .action-buttons, .print-button, .share-button, .download-image-btn,
    .worksheet-controls, .show-answer-btn, .breadcrumbs, .image-container,
    .ad-unit, .featured-resource, .newsletter-form, .cta-section, .cta-exercise,
    #goToQuickLinksBtn, .lightbox-modal, .top-menu-class, .sidebar-class, .footer-class,
    .rating-container, .promo-box-section /* Hide promo box in print */
    {
        display: none !important;
    }

    .page-wrapper {
         display: block !important;
         margin: 0 !important;
         padding: 0 !important;
    }
    .main-content {
        box-shadow: none !important;
        padding: 0 !important;
        width: 100% !important;
        float: none !important;
        padding-bottom: 40px;
        margin: 0 !important;
    }

    h1, h2, h3, h4, h5, h6 {
        margin-top: 15px;
        margin-bottom: 10px;
        page-break-after: avoid;
        color: black !important;
    }
    table {
        page-break-inside: auto;
        width: 100% !important;
    }
    thead {
        display: table-header-group;
    }
    tr, li, p {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    section, article {
        page-break-inside: avoid;
    }

    .feature-image, .gallery-item img {
        max-width: 100% !important;
        height: auto !important;
        display: block;
        margin: 10px auto;
    }
     .gallery-grid {
        display: block !important;
    }
    .gallery-item {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none !important;
    }
    .gallery-caption {
        position: static !important;
        transform: none !important;
        background: #f0f0f0 !important;
        color: black !important;
        padding: 5px !important;
        margin-top: 5px;
    }
    .answer-content {
        display: block !important;
        border: 1px solid #ccc !important;
        background-color: #f9f9f9 !important;
        font-style: italic;
    }

    .print-footer-info {
        display: block !important;
        position: fixed;
        bottom: 10px;
        left: 0;
        width: 100%;
        text-align: center;
        font-size: 0.8rem;
        color: #555 !important;
        border-top: 1px solid #eee !important;
        padding-top: 5px;
    }
    .print-footer-info a {
        color: #555 !important;
        text-decoration: none !important;
    }
    .print-footer-info a:after {
        content: "" !important;
    }
}
</style>
<style>
#lightboxDefinition a {
    color: red;              /* Sets the link color to red */
    font-weight: bold;       /* Makes the link text bold */
    text-decoration: none;   /* Optional: Removes the default underline */
}

/* Style for when you hover over the lightbox link */
#lightboxDefinition a:hover {
    color: #cc0000;          /* A darker red for the hover effect */
    text-decoration: underline; /* Shows an underline on hover for clarity */
} 

/* =================================================================== */
/* Session Message Box Styles */
/* =================================================================== */
.session-message-box {
    position: fixed;
    bottom: 20px;
    right: 20px; /* Changed from 'left' */
    max-width: 300px;
    background-color: #ffffff;
    color: #333;
    border: 1px solid #ddd;
    border-right: 5px solid var(--header-bg, #0056b3); /* Changed from 'border-left' */
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1010;
    transform: translateX(120%); /* Changed to hide it on the right */
    transition: transform 0.6s ease-in-out;
    visibility: hidden;
}

.session-message-box.visible {
    transform: translateX(0);
    visibility: visible;
}

.message-box-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.message-box-close:hover {
    color: #333;
}

.session-message-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--header-bg, #0056b3);
    font-size: 1.1rem;
}

.session-message-box p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.message-box-link {
    display: inline-block;
    background-color: var(--header-bg-hover, #00448a);
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.message-box-link:hover {
    background-color: var(--header-bg, #0056b3);
    color: white;
}

/* Styles for the Tabbed Worksheet Section */
.worksheet-tabs-container {
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-top: 30px;
    overflow: hidden; /* Contains the floated elements */
}
.worksheet-tab-buttons {
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
    overflow: hidden;
}
.worksheet-tab-link {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 1rem;
    color: var(--new-link-color); /* 1. Makes button text blue */
    border-bottom: 3px solid transparent; /* Reserves space for the underline to prevent jumping */
}
.worksheet-tab-link:hover {
    background-color: #e0e0e0; /* A slightly softer hover color */
}
.worksheet-tab-link.active {
    font-weight: bold;
    border-bottom: 3px solid var(--new-link-color); /* 2. Adds blue underline to the ACTIVE tab */
}
.worksheet-tab-content {
    padding: 15px;
    display: none; /* All tabs are hidden by default */
    border-top: none;
}
/* Add an underline to links within main content paragraphs for accessibility */
.main-content p a {
    text-decoration: underline;
}
/* New CSS for Author Bio with Image */
.author-bio-content {
    display: flex;
    align-items: flex-start; /* Aligns items to the top */
    gap: 25px; /* Space between image and text */
}

.author-image-container {
    flex: 0 0 150px; /* Do not grow, do not shrink, base width of 150px */
}

.author-image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 50%; /* Makes the image circular */
    border: 3px solid var(--border-color, #ddd);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.author-text-content {
    flex: 1; /* Allows the text to take up the remaining space */
}

/* Responsive adjustments for mobile screens */
@media (max-width: 600px) {
    .author-bio-content {
        flex-direction: column; /* Stacks image and text vertically */
        align-items: center; /* Centers items for a clean mobile look */
    }
    
    .author-text-content {
        text-align: center; /* Centers the text on mobile */
    }
}

/* CSS for About Author Section */
.author-bio {
    background-color: #f8f9fa; /* A light, neutral background */
    border-left: 5px solid var(--header-bg, #0056b3);
    padding: 25px;
    margin: 40px 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.author-bio h2 {
    margin-top: 0;
    color: var(--menu-bg, #2c3e50);
    border-bottom: 2px solid var(--border-color, #ddd);
    padding-bottom: 10px;
    font-size: 1.8rem;
}

.author-bio h3 {
    color: var(--header-bg, #0056b3);
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.author-bio .job-title {
    font-size: 1.1em;
    font-style: italic;
    color: #555;
    margin-top: -5px;
    margin-bottom: 20px;
}

.author-bio ul {
    list-style-type: disc;
    padding-left: 25px;
    margin-top: 10px;
}

.author-bio ul li {
    margin-bottom: 8px;
    line-height: 1.5;
}