/* =============================================================
   GLOBAL GOOGLE-LIKE MODERN STYLE (OLIVE THEME)
   Optimized and cleaned version
   ============================================================ */

/* ---------- Reset & Base ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    /* Forces a vertical scrollbar track to always be visible.
     This stops the layout shift between short/long pages, but unlike
     'scrollbar-gutter', the browser draws an inactive scrollbar track
     over the space, which looks much more natural and doesn't visually
     cut off full-width background colors like the footer. */
    overflow-y: scroll;
}

html,
body {
    height: 100%;
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    color: #202124;
    line-height: 1.5;
    background-color: #f8f9fa;
    margin: 0;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Firefox keeps native fonts on form controls unless we inherit explicitly. */
button,
input,
select,
textarea {
    font-family: inherit;
}

/* Force footer to the bottom */
footer {
    margin-top: auto;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ---------- Definition Note Styles ---------- */
.definition-note {
    color: #adb5bd;
    font-style: italic;
    padding-right: 2px;
    font-size: 0.9rem;
}

.definition-note-parentheses {
    font-style: normal;
    color: #adb5bd;
    font-size: 0.9rem;
}

/* ---------- Header / Title ---------- */
header {
    text-align: center;
    margin-top: 1vh;
    margin-bottom: 3vh;
    max-width: 1135px;
    margin-left: auto;
    margin-right: auto;
    padding-right: 280px;
    /* sidebar(280) + gap(24) + 6px flex remainder */
    box-sizing: border-box;
}

.site-title {
    font-size: 1.2rem;
    font-weight: 600;
    /* letter-spacing: -0.5px; */
    color: #202124;
    transition: color 0.3s ease;
    user-select: none;
    line-height: 1.5rem;
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-title a:hover {
    color: #808000;
}

/* ---------- Helper Switcher and Panels ---------- */
.language-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 10px;
}

.helper-switcher {
    display: inline-flex;
    background: #f1f3f4;
    border-radius: 10px;
    padding: 2px;
    gap: 3px;
    margin-left: auto;
    border: 1px solid #dadce0;
}

.helper-btn {
    border: none;
    background: transparent;
    color: #5f6368;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
    margin: 0px;
}

.helper-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #202124;
}

.helper-btn.active {
    background: #ffffff;
    color: #808000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.helper-panel {
    display: none;
    /* animation: fadeIn 0.2s ease; */
    margin-top: 15px;
}

.helper-panel.active {
    display: block;
}

.helper-panel-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    color: #202124;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
}

.helper-text-block p {
    margin: 0 0 12px;
}

.helper-text-block p:last-child {
    margin-bottom: 0;
}

.helper-simple-entry {
    display: block;
}

.helper-headword {
    display: block;
    font-weight: 600;
    color: #202124;
    margin-bottom: 4px;
}

.helper-simple-note {
    line-height: 1.6;
}

.ru-source-block,
.de-source-block {
    margin-bottom: 20px;
}

.ru-source-block:last-child,
.de-source-block:last-child {
    margin-bottom: 0;
}

.ru-source-title,
.de-source-title {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    margin-bottom: 12px;
    font-weight: 600;
    display: block;
}

.ru-source-divider,
.de-source-divider {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#kaDefinitionContent.hidden {
    display: none;
}

/* ---------- Search Section ---------- */
.search-form {
    display: flex;
    max-width: 500px;
    width: 500px;
    /* margin: 0 auto; */
    padding: 0 10px;
    border-radius: 8px;
    gap: 0;
}

.search-input-container {
    position: relative;
    flex: 1;
    max-width: 450px;
}

/* Position search results relative to input container for better alignment */
.search-input-container #searchResultsContainer {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-width: 500px;
    z-index: 1000;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #dadce0;
    margin: 0;
    padding: 8px;
    max-height: 420px;
    min-height: 100px;
    overflow-y: auto;
    /* Explicitly tell Chrome to optimize this layer */
    will-change: transform, opacity;
    /* Strict isolation so contents don't affect layout outside this box */
    contain: content;
}

/* Make search results wider on mobile to maximize screen real estate */

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    color: #5f6368;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.search-icon svg {
    width: 100%;
    height: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 40px;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid #dadce0;
    border-radius: 8px 0 0 8px;
    outline: none;
    transition:
        border-color 0.3s,
        box-shadow 0.3s;
    border-right: none;
}

.search-input:focus {
    border-color: #808000;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.06);
}

/* ---------- Clear Search Button ---------- */
.clear-search {
    position: absolute;
    right: 5px;
    top: 50%;
    /* Scale is part of the transform so it doesn't fight translateY */
    transform: translateY(-50%) scale(0.6);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    z-index: 2;
    font-size: 0;
    opacity: 0;
    /* pointer-events instead of visibility — fully transitionable */
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        /* spring overshoot */
        background-color 0.15s ease;
}

.clear-search.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

/* mask-image lets the icon color transition smoothly */
.clear-search::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background-color: #aaa;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: background-color 0.15s ease;
}

.clear-search:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

.clear-search:hover::before {
    background-color: #555;
}

/* Adjust tap target on mobile without overflowing input */
@media (max-width: 768px) {
    .clear-search {
        width: 28px;
        height: 28px;
        right: 4px;
        /* Re-state the full transform so the hidden scale-down is unambiguous */
        transform: translateY(-50%) scale(0.6);
        /* Eliminate the 300ms tap delay on touch browsers */
        touch-action: manipulation;
    }

    .clear-search.visible {
        transform: translateY(-50%) scale(1);
    }

    .clear-search::before {
        width: 16px;
        height: 16px;
    }
}

.search-button {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background-color: #808000;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition:
        background-color 0.3s,
        box-shadow 0.3s;
    font-family: inherit;
}

.search-button:hover {
    background-color: #6a6a00;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ---------- Search Results Overlay ---------- */
main {
    position: relative;
    flex-grow: 1;
    /* ADD THIS to the existing 'main' block */
}

/* Add this to prevent flicker while the "Searching..." text is showing */
#searchResultsContainer:empty {
    display: none;
}

#definitionContent {
    position: relative;
    z-index: 1;
    margin: 20px auto;
    padding: 15px 20px 15px 20px;
    max-width: 1165px;
    width: calc(100% - 20px);
    margin-bottom: 120px;
    min-height: 300px;
    transition: opacity 0.2s ease;
}

/* ---------- Definition Layout: Main + Sidebar ---------- */
.definition-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.definition-main {
    flex: 1 1 0%;
    max-width: 825px;
    min-width: 0;
}

.definition-sidebar {
    flex: 0 0 280px;
    width: 280px;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

.sidebar-section {
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.sidebar-heading {
    font-size: 0.85rem;
    font-weight: 600;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #808000;
}

.related-terms-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 4px;
}

.related-terms-list li {
    margin: 0;
    min-width: 0;
    overflow: hidden;
}

.related-terms-list li a {
    display: block;
    padding: 7px 10px;
    color: #202124;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-terms-list li a:hover {
    background: rgba(128, 128, 0, 0.08);
    color: #808000;
    padding-left: 14px;
}

/* --- Facebook Placeholder --- */
.sidebar-fb-placeholder {
    text-align: center;
    padding: 10px 0;
}

.fb-placeholder-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1877f2;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-family: "Helvetica Neue", Arial, sans-serif;
}

.fb-placeholder-text {
    font-size: 0.85rem;
    color: #5f6368;
    margin: 0 0 12px;
}

.fb-follow-btn {
    display: inline-block;
    padding: 7px 24px;
    background: #1877f2;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.fb-follow-btn:hover {
    background: #1565c0;
}

/* --- Ad Placeholder --- */
.ad-placeholder {
    text-align: center;
    padding: 10px 0;
}

.ad-label {
    font-size: 0.7rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 8px;
}

.ad-slot {
    min-height: 250px;
    background: #f1f3f4;
    border: 1px dashed #dadce0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 0.8rem;
}

.ad-slot::after {
    content: "Ad Space";
    color: #ccc;
    font-style: italic;
}

/* Dark mode sidebar */
body.dark-mode .sidebar-section {
    background: linear-gradient(135deg, #313647 0%, #222831 100%) !important;
    border-color: #444;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .sidebar-heading {
    color: #aaa;
    border-bottom-color: #808000;
}

body.dark-mode .related-terms-list li a {
    color: #e0e0e0;
}

body.dark-mode .related-terms-list li a:hover {
    background: rgba(128, 128, 0, 0.15);
    color: #b0b000;
}

body.dark-mode .fb-placeholder-text {
    color: #aaa;
}

body.dark-mode .ad-slot {
    background: #333;
    border-color: #555;
}

body.dark-mode .ad-slot::after {
    color: #666;
}

body.dark-mode .ad-label {
    color: #666;
}

/* Responsive: stack sidebar below on smaller screens */
@media (max-width: 1024px) {
    .definition-layout {
        flex-direction: column;
    }

    .definition-main {
        max-width: 100%;
    }

    .definition-sidebar {
        width: 100%;
        flex: 0 0 auto;
        position: static;
    }

    /* Remove sidebar alignment offset when sidebar stacks */
    header,
    .total-words,
    .main-navigation {
        padding-right: 0;
        max-width: 100%;
    }

    .main-navigation {
        padding-right: 10px;
        /* restore original right padding */
    }

    .logo-container {
        left: 50%;
        /* reset from calc-based centering */
    }
}

/* ---------- Results Container / Word Block ---------- */
.results {
    max-width: 500px;
    margin: 20px auto;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-family: inherit;
}

.word-block {
    padding: 1px;
    border-bottom: 2px dotted #eee;
    transition: background-color 0.2s;
}

.word-block:last-child {
    border-bottom: none;
}

.word-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1px;
}

/* Search result links */
.search-summary-item .word-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.search-summary-item .word-name a:visited,
.search-summary-item .word-name a:hover,
.search-summary-item .word-name a:active {
    color: inherit;
    text-decoration: none;
}

#searchResultsContainer .word-name strong {
    font-weight: 700;
}

/* ---------- Word Definition Page Styles ---------- */
.word-page-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 3rem;
    font-weight: 700;
    color: #808000;
}

.word-page-main-title {
    font-size: 1.3rem;
    margin: 0;
}

/* Pronunciation Styles */
.pronunciation-section {
    margin: 5px 0 0 0;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #808000;
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
}

.ipa-pronunciation {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
}

.ipa-pronunciation strong {
    color: #202124;
    font-weight: 600;
    white-space: nowrap;
}

.ipa-text {
    font-family: "Inter", "Noto Sans Georgian", sans-serif;
    font-weight: 500;
    color: #333;
    background: #f1f3f4;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.audio-pronunciation {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #808000;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition:
        background-color 0.2s,
        box-shadow 0.2s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.audio-btn:hover {
    background: #6a6a00;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.audio-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.type-section {
    margin-bottom: 0;
    padding: 0 0 15px 0;
    border-bottom: 1px dashed #ccc;
}

.type-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.type-name {
    font-style: italic;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 10px;
    margin-top: 10px;
    display: block;
    text-transform: lowercase !important;
}

.definition-item {
    margin-bottom: 4px;
    display: flex;
    align-items: flex-start;
}

.definition-number {
    font-weight: 600;
    margin-right: 10px;
    color: #808000;
    flex-shrink: 0;
}

.definition-content {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-grow: 1;
}

.category-tag {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #808000;
    color: #fff;
    text-transform: uppercase;
    font-weight: 500;
    margin-left: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

.meaning {
    margin: 0;
    line-height: 1.6;
    font-family: "Noto Sans Georgian", sans-serif;
    font-size: 1rem;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "wdth" 100;
}

/* ---------- Total Words Counter ---------- */
.total-words {
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
    font-weight: 500;
    font-style: italic;
    max-width: 1135px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    font-family: inherit;
}

.resource-desc,
.resource-stats {
    font-family: inherit;
}

/* ---------- Navigation Styles ---------- */
.main-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1135px;
    margin: 0 auto;
    padding: 5px 10px 0 10px;
    padding-right: 290px;
    box-sizing: border-box;
    position: relative;
    width: 100%;
    min-height: 80px;
}

/* Logo container - properly spaced */
.logo-container {
    flex: 0 0 auto;
    text-align: center;
    z-index: 10;
    margin: 0 auto;
    position: absolute;
    left: calc((100% - 280px) / 2);
    transform: translateX(-50%);
}

.logo-container a {
    display: inline-block;
    text-decoration: none;
}

.site-logo {
    max-width: 55px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.site-logo:hover {
    /* transform: scale(1.05); */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Navigation menus - FIXED */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.nav-menu-left {
    justify-content: flex-end;
    margin-right: 80px;
    /* Space for logo */
}

.nav-menu-right {
    justify-content: flex-start;
    margin-left: 0px;
    /* Space for logo */
}

/* Navigation */
.nav-item {
    text-decoration: none;
    color: #202124;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0px;
    padding: 4px 6px;
    position: relative;
    transition: color 0.3s ease;
    white-space: nowrap;
    border-radius: 5px;
}

.nav-item:hover {
    color: #808000;
    background-color: rgba(128, 128, 0, 0.05);
}

/* Language switcher - compact */
.language-switcher-nav {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    padding: 2px;
    margin: 0px 0px 0px 2px;
    font-size: 12px;
    font-weight: 500;
    height: 28px;
    flex-shrink: 0;
}

.language-switcher-nav .language-link {
    padding: 3px 10px;
    text-decoration: none;
    color: #555;
    border-radius: 16px;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 600;
}

.language-switcher-nav .language-link:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.language-switcher-nav .language-link.active {
    background: #808000;
    /* #4CAF50 */
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.language-switcher-nav .language-separator {
    color: rgba(0, 0, 0, 0.2);
    font-weight: 300;
    margin: 0 1px;
}

/* Dark Mode Toggle */
.dark-mode-toggle-container {
    display: flex;
    align-items: center;
    margin-left: 6px;
    flex-shrink: 0;
}

#darkModeToggle {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    padding: 0;
    border-radius: 25px;
    font-size: 0.8rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

#darkModeToggle:hover {
    background: #f8f9fa;
    border-color: #808000;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toggle-icon {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}

body.dark-mode .toggle-icon {
    transform: rotate(180deg) scale(1);
}

/* ---------- Mobile Menu ---------- */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1002;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
    order: 1;
}

.mobile-menu-toggle:hover {
    background-color: rgba(128, 128, 0, 0.05);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 24px;
    height: 18px;
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background-color: #202124;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-menu-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background-color: #ffffff;
    padding: 30px 25px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.mobile-menu-content.active {
    transform: translateX(0);
}

.mobile-nav-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.mobile-nav-item {
    text-decoration: none;
    color: #202124;
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.mobile-nav-item:hover {
    color: #808000;
    background-color: rgba(128, 128, 0, 0.05);
    border-color: #808000;
}

.mobile-nav-item:first-child {
    margin-top: 10px;
}

/* Mobile language switcher */
.mobile-language-switcher {
    margin: 10px 0 10px 0;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.mobile-language-switcher span {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.mobile-language-links {
    display: flex;
    gap: 5px;
}

.mobile-language-link {
    /* Use the expanded syntax for maximum compatibility */
    flex-grow: 1;
    flex-shrink: 0;
    /* Prevent shrinking below content size, just in case */
    flex-basis: 0;
    /* <-- THE KEY FIX: forces calculation to start from 0 */
    /* Ensure it behaves like a block element inside the flex container */
    display: block;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 14px;
}

.mobile-language-link:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.mobile-language-link.active {
    background: #808000;
    color: white;
    border-color: #808000;
}

.mobile-dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 6px;
    background-color: #f8f9fa;
    margin-top: 10px;
}

.mobile-dark-mode-toggle span {
    font-weight: 600;
    color: #202124;
}

#mobileDarkModeToggle {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    padding: 0;
    border-radius: 25px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Hide mobile menu toggle when mobile menu is open */
.mobile-menu-content.active~.mobile-menu-toggle {
    display: none;
}

/* ---------- Footer ---------- */
footer {
    background-color: #343a40;
    color: #ffffff;
    padding: 5px 0;
    font-size: 0.8rem;
    text-align: center;
    flex-shrink: 0;
    padding-right: 280px;
    position: relative;
    z-index: 10;
}

@media (max-width: 1024px) {
    footer {
        padding-right: 0;
    }
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 1px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #808000;
    text-decoration: underline;
}

.copyright {
    color: #adb5bd;
    margin-top: 0px;
}

.copyright a {
    color: #adb5bd;
    text-decoration: none;
}

.copyright a:hover {
    color: #808000;
    text-decoration: underline;
}

/* Quality Notice in Footer */
.quality-notice {
    margin: 10px auto 15px auto;
    max-width: 800px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #808000;
}

.quality-notice small {
    color: #666;
    font-size: 0.8rem;
    line-height: 1.4;
}

.quality-notice strong {
    color: #202124;
}

.quality-notice a {
    color: #808000;
    text-decoration: none;
    font-weight: 500;
}

.quality-notice a:hover {
    text-decoration: underline;
}

/* ---------- User Contribution Styles ---------- */
.user-engagement-section {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    text-align: center;
}

.engagement-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 7px;
}

.engagement-btn {
    padding: 9px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.engagement-btn.primary {
    background: #808000;
    color: white;
}

.engagement-btn.primary:hover {
    background: #6a6a00;
}

.engagement-btn.secondary {
    background: #6c757d;
    color: white;
}

.engagement-btn.secondary:hover {
    background: #545b62;
}

.engagement-note {
    color: #666;
    font-size: 12px;
    margin-top: 8px;
    font-style: italic;
}

.contribution-section {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    border-top: 0 solid #eee;
}

.word-block-b {
    text-align: center;
    margin-top: 0;
    border-top: 0 solid #eee;
    padding: 5px 0 10px 0;
}

.contribution-btn {
    background: #808000;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition:
        background-color 0.2s,
        box-shadow 0.2s;
    margin-top: 10px;
}

.contribution-btn:hover {
    background: #6a6a00;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.contribution-note {
    font-size: 0.8rem;
    color: #666;
    margin-top: 8px;
    font-style: italic;
    margin-left: 14%;
    margin-right: 14%;
}

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

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

.modal .close {
    color: #aaa;
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal .close:hover {
    color: #000;
    background-color: rgba(0, 0, 0, 0.05);
}

.modal-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 0px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #808000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #666;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.modal-success-state {
    text-align: center;
    padding: 28px 12px 8px;
}

.modal-success-title {
    margin: 0 0 12px;
    font-size: 1.35rem;
    color: #222;
}

.modal-success-message {
    margin: 0 auto;
    max-width: 450px;
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
}

.btn-primary,
.back-to-dictionary-btn {
    background: #808000;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition:
        background-color 0.2s,
        box-shadow 0.2s;
    font-family: inherit;
}

.btn-primary:hover,
.back-to-dictionary-btn:hover {
    background: #6a6a00;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background: #545b62;
}

/* ---------- About Page Styles ---------- */
.about-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.about-header {
    text-align: center;
    margin-bottom: 50px;
}

.about-header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.about-header .subtitle {
    font-size: 1.2rem;
    color: #7f8c8d;
    font-weight: 400;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 50px;
    align-items: start;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.profile-section,
.social-section,
.photo-section,
.facebook-section,
.contact-widget {
    background: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Legacy Profile Styles Removed */

.expertise-section {
    margin-top: 30px;
}

.expertise-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.expertise-tag {
    background: #f8f9fa;
    color: #808000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.expertise-tag:hover {
    background: #808000;
    color: white;
    /* transform: translateY(-2px); */
}

.social-section {
    padding: 30px;
    text-align: center;
}

.social-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.social-section p {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

.social-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    color: white;
}

.social-link span {
    margin-left: 8px;
}

.social-link.facebook {
    background: #3b5998;
}

.social-link.instagram {
    background: #e4405f;
}

.social-link.twitter {
    background: #1da1f2;
}

.social-link.linkedin {
    background: #0077b5;
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.profile-photo-container {
    position: relative;
    overflow: hidden;
}

.profile-photo {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 20px;
    text-align: center;
}

.photo-caption {
    padding: 20px;
}

.photo-caption p {
    line-height: 1.6;
    color: #555;
}

.facebook-section,
.contact-widget {
    padding: 25px;
}

.facebook-section h3,
.contact-widget h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.facebook-section p,
.contact-widget p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 0.9rem;
}

.fb-page-placeholder {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    border: 2px dashed #dadce0;
}

.fb-placeholder-content h4 {
    color: #1877f2;
    margin-bottom: 10px;
    font-weight: 600;
}

.fb-placeholder-content p {
    color: #65676b;
    margin-bottom: 20px;
}

.fb-follow-btn {
    background: #1877f2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.fb-follow-btn:hover {
    background: #166fe5;
}

.contact-btn {
    display: inline-block;
    background: #808000;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.contact-btn:hover {
    background: #6a6a00;
    transform: translateY(-2px);
}

/* ---------- New Client Conversion Elements ---------- */
.source-badge {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #808000;
}

.source-disclosure {
    font-size: 0.85rem;
}

.source-disclosure summary {
    cursor: pointer;
    font-weight: 500;
    color: #333;
    list-style: none;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-disclosure summary::-webkit-details-marker {
    display: none;
}

.source-disclosure summary::before {
    content: "ℹ️";
    margin-right: 5px;
}

.source-disclosure[open] summary {
    margin-bottom: 8px;
}

.source-disclosure small {
    color: #666;
    line-height: 1.5;
    display: block;
    padding-left: 28px;
}

.source-disclosure a {
    color: #808000;
    text-decoration: none;
    font-weight: 500;
}

.source-disclosure a:hover {
    text-decoration: underline;
}

.professional-services-cta {
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.professional-services-cta h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
    text-align: left;
}

.professional-services-cta>p {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: left;
}

.service-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    text-align: left;
}

.feature {
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.feature strong {
    color: #808000;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 5px;
}

.feature p {
    color: #666;
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0;
}

.cta-button-container {
    text-align: center;
    margin-top: 20px;
}

.cta-button {
    display: inline-block;
    background: #808000;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    margin-top: 10px;
}

.cta-button:hover {
    background: #6a6a00;
    /* transform: translateY(-2px); */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.professional-services-cta small {
    display: block;
    color: #666;
    font-size: 0.75rem;
    text-align: center;
    margin-top: 7px;
    font-style: italic;
}

/* Green Initiative Banner */
.green-initiative-banner {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-radius: 10px;
    border: 1px solid #c5e1a5;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 30px;
}

.green-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 500px;
    /* fills row to keep left margin solid, wraps if width < 500px */
    min-width: 0;
}

.green-icon {
    font-size: 1.5rem;
}

.green-text {
    display: flex;
    flex-direction: column;
}

.green-text strong {
    color: #2e7d32;
    font-size: 0.9rem;
}

.green-text small {
    color: #555;
    font-size: 0.8rem;
    margin-top: 2px;
    max-width: 600px;
    line-height: 1.4;
}

.green-learn-more {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    padding: 6px 12px;
    border: 1px solid #2e7d32;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin: 2px auto 0;
}

.green-learn-more:hover {
    background: #2e7d32;
    color: white;
}

/* Submission Result Page */
.submission-result-container {
    max-width: 600px;
    margin: 5px auto;
    text-align: center;
    padding: 0 20px;
}

.message-box {
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    font-size: 15px;
    line-height: 1.6;
}

.message-box.success {
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
    color: #2e7d32;
}

.message-box.error {
    background-color: #ffebee;
    border: 2px solid #f44336;
    color: #c62828;
}

.message-box.blocked {
    background-color: #fff3e0;
    border: 2px solid #ff9800;
    color: #ef6c00;
}

.back-button-container {
    margin-top: 30px;
}

/* ============================================================
   DARK MODE STYLES
   ============================================================ */
body.dark-mode {
    background-color: #222831 !important;
    color: #e8eaed !important;
}

body.dark-mode header .site-title a {
    color: #e8eaed !important;
}

body.dark-mode .search-form .search-input {
    background-color: #313647 !important;
    color: #e8eaed !important;
    border: 1px solid #555 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .search-form .search-input:focus {
    border-color: #808000 !important;
    box-shadow: 0 2px 8px rgba(128, 128, 0, 0.4) !important;
}

body.dark-mode .search-form .search-button {
    background-color: #808000 !important;
    color: #fff !important;
}

body.dark-mode .sbar-filter-btn,
body.dark-mode .defp-filter-btn {
    background-color: #313647 !important;
    color: #e8eaed !important;
    border: 1px solid #555 !important;
}

body.dark-mode .sbar-filter-btn:hover,
body.dark-mode .defp-filter-btn:hover {
    background-color: #3a4156 !important;
    border-color: #808000 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .cat-filter-panel {
    background-color: #303341 !important;
    /* #222831 */
    border-color: #444 !important;
}

body.dark-mode .cat-filter-search-wrap,
body.dark-mode .cat-filter-footer {
    border-color: #444 !important;
}

body.dark-mode .cat-filter-search-input {
    color: #e8eaed !important;
}

body.dark-mode .cat-filter-option {
    color: #e8eaed !important;
}

body.dark-mode .cat-filter-option:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #fff !important;
}

body.dark-mode #searchResultsContainer {
    background-color: #313647 !important;
    border-color: #555 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .results {
    background-color: #313647 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .word-block {
    border-bottom: 1px dotted #5f6062 !important;
}

body.dark-mode .word-page-title {
    color: #a0a000 !important;
}

body.dark-mode .type-section {
    border-bottom: 1px dashed #444 !important;
}

body.dark-mode .type-name {
    color: #b0b0b0 !important;
}

body.dark-mode .definition-number {
    color: #a0a000 !important;
}

body.dark-mode .category-tag {
    background-color: #808000 !important;
    color: white !important;
}

body.dark-mode .meaning {
    color: #e8eaed !important;
}

body.dark-mode .total-words {
    color: #b0b0b0 !important;
}

body.dark-mode .definition-note,
body.dark-mode .definition-note-parentheses {
    color: #b0b0b0 !important;
}

body.dark-mode .pronunciation-section {
    background: #303341 !important;
    border-left-color: #a0a000 !important;
}

body.dark-mode .ipa-pronunciation strong {
    color: #e8eaed !important;
}

body.dark-mode .ipa-text {
    background: #4a5568 !important;
    color: #e8eaed !important;
    border-color: #555 !important;
}

body.dark-mode .audio-btn {
    background: #a0a000 !important;
}

body.dark-mode .audio-btn:hover {
    background: #8a8a00 !important;
}

/* Navigation Dark Mode */
body.dark-mode .nav-item {
    color: #e8eaed !important;
}

body.dark-mode .nav-item:hover {
    color: #a0a000 !important;
    background-color: rgba(160, 160, 0, 0.1);
}

/* User Profile Dark Mode */
body.dark-mode .google-login-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e8eaed !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
}

body.dark-mode .google-login-btn:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .user-badge {
    color: #e8eaed !important;
}

body.dark-mode .user-badge:hover {
    color: #a0a000 !important;
    background-color: rgba(160, 160, 0, 0.1) !important;
}

body.dark-mode .user-avatar {
    border-color: #a0a000 !important;
}

body.dark-mode .user-avatar-initial {
    background-color: #a0a000 !important;
}

body.dark-mode .logout-link {
    color: #b0b0b0 !important;
}

body.dark-mode .logout-link:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.2) !important;
}

body.dark-mode .hamburger-line {
    background-color: #e8eaed !important;
}

body.dark-mode .mobile-menu-content {
    background-color: #222831 !important;
}

body.dark-mode .mobile-nav-item {
    color: #e8eaed !important;
}

body.dark-mode .mobile-nav-item:hover {
    color: #a0a000 !important;
    background-color: rgba(160, 160, 0, 0.1);
}

body.dark-mode .mobile-dark-mode-toggle {
    background-color: #313647;
}

body.dark-mode .mobile-dark-mode-toggle span {
    color: #e8eaed;
}

/* Dark Mode Toggle Button */
body.dark-mode #darkModeToggle {
    background: #313647 !important;
    border-color: #555 !important;
}

body.dark-mode #darkModeToggle:hover {
    background: #3a3a3a !important;
    border-color: #a0a000 !important;
}

/* Legacy rotation removed - replaced with 360deg logic near line 776 */

/* Logo switching
body.dark-mode .site-logo {
  content: url('logo-light.png') !important;
} */

/* Footer Dark Mode */
body.dark-mode footer {
    background-color: #1c2129 !important;
}

body.dark-mode .footer-links a,
body.dark-mode .copyright,
body.dark-mode .copyright a {
    color: #adb5bd !important;
}

body.dark-mode .footer-links a:hover,
body.dark-mode .copyright a:hover {
    color: #808000 !important;
}

body.dark-mode .quality-notice {
    background: #313647 !important;
    border-left-color: #a0a000 !important;
}

/* Helper Switcher and Panels Dark Mode */
body.dark-mode .helper-switcher {
    background: #2a2f3a !important;
    border-color: #444 !important;
}

body.dark-mode .helper-btn {
    color: #adb5bd !important;
}

body.dark-mode .helper-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #e8eaed !important;
}

body.dark-mode .helper-btn.active {
    background: #313647 !important;
    color: #a0a000 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .helper-panel-content {
    background-color: #313647 !important;
    color: #e8eaed !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    border-color: #444 !important;
}

body.dark-mode .ru-source-title,
body.dark-mode .de-source-title {
    color: #b0b0b0 !important;
}

body.dark-mode .ru-source-divider,
body.dark-mode .de-source-divider {
    border-top-color: #444 !important;
}

body.dark-mode .ru-dict-entry {
    color: #e8eaed !important;
}

body.dark-mode .helper-headword {
    color: #e8eaed;
}

body.dark-mode .ru-pos {
    color: #a0a000 !important;
}

body.dark-mode .ru-example {
    color: #b0b0b0 !important;
}

body.dark-mode .ru-term {
    color: #aecbfa !important;
}

body.dark-mode .ru-note,
body.dark-mode .ru-pronunciation {
    color: #b0b0b0 !important;
}

body.dark-mode .ru-synonyms {
    color: #b0b0b0 !important;
}

body.dark-mode .quality-notice small {
    color: #b0b0b0 !important;
}

body.dark-mode .quality-notice strong {
    color: #e8eaed !important;
}

body.dark-mode .quality-notice a {
    color: #a0a000 !important;
}

/* User Engagement Dark Mode */
body.dark-mode .user-engagement-section {
    background: linear-gradient(135deg, #313647 0%, #222831 100%) !important;
    border: 1px solid #444 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .engagement-note {
    color: #b0b0b0 !important;
}

body.dark-mode .contribution-btn {
    background: #a0a000 !important;
}

body.dark-mode .contribution-btn:hover {
    background: #8a8a00 !important;
}

body.dark-mode .contribution-note {
    color: #b0b0b0 !important;
}

/* Modal Dark Mode */
body.dark-mode .modal-content {
    background-color: #222831 !important;
    color: #e8eaed !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .modal .close {
    color: #b0b0b0 !important;
}

body.dark-mode .modal .close:hover {
    color: #e8eaed !important;
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .modal-description {
    color: #b0b0b0 !important;
}

body.dark-mode .form-group label {
    color: #e8eaed !important;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background-color: #313647 !important;
    color: #e8eaed !important;
    border: 1px solid #555 !important;
}

body.dark-mode .form-group input:focus,
body.dark-mode .form-group select:focus,
body.dark-mode .form-group textarea:focus {
    border-color: #a0a000 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .form-group small {
    color: #b0b0b0 !important;
}

body.dark-mode .btn-primary,
body.dark-mode .back-to-dictionary-btn {
    background: #a0a000 !important;
}

body.dark-mode .btn-primary:hover,
body.dark-mode .back-to-dictionary-btn:hover {
    background: #8a8a00 !important;
}

body.dark-mode .btn-secondary {
    background: #6c757d !important;
}

body.dark-mode .btn-secondary:hover {
    background: #545b62 !important;
}

/* About Page Dark Mode */
body.dark-mode .about-header h1 {
    color: #e8eaed !important;
}

body.dark-mode .about-header .subtitle {
    color: #b0b0b0 !important;
}

body.dark-mode .profile-section,
body.dark-mode .social-section,
body.dark-mode .photo-section,
body.dark-mode .facebook-section,
body.dark-mode .contact-widget {
    background: #313647 !important;
}

body.dark-mode .profile-body p {
    color: #e8eaed !important;
}

body.dark-mode .profile-body h3 {
    color: #e8eaed !important;
}

body.dark-mode .expertise-tag {
    background: #222831 !important;
    color: #a0a000 !important;
    border-color: #444 !important;
}

body.dark-mode .expertise-tag:hover {
    background: #a0a000 !important;
    color: white !important;
}

body.dark-mode .social-section h3,
body.dark-mode .facebook-section h3,
body.dark-mode .contact-widget h3 {
    color: #e8eaed !important;
}

body.dark-mode .social-section p,
body.dark-mode .facebook-section p,
body.dark-mode .contact-widget p,
body.dark-mode .photo-caption p {
    color: #b0b0b0 !important;
}

body.dark-mode .fb-page-placeholder {
    background: #222831 !important;
    border-color: #555 !important;
}

body.dark-mode .fb-placeholder-content h4 {
    color: #a0a000 !important;
}

body.dark-mode .fb-placeholder-content p {
    color: #b0b0b0 !important;
}

body.dark-mode .contact-btn {
    background: #a0a000 !important;
}

body.dark-mode .contact-btn:hover {
    background: #8a8a00 !important;
}

/* New Client Elements Dark Mode */
body.dark-mode .source-badge {
    background: #313647 !important;
    border-left-color: #a0a000 !important;
}

body.dark-mode .source-disclosure summary {
    color: #e8eaed !important;
}

body.dark-mode .source-disclosure small {
    color: #b0b0b0 !important;
}

body.dark-mode .source-disclosure a {
    color: #a0a000 !important;
}

body.dark-mode .professional-services-cta {
    background: linear-gradient(135deg, #313647 0%, #222831 100%) !important;
    border-color: #444 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .professional-services-cta h4 {
    color: #e8eaed !important;
}

body.dark-mode .professional-services-cta>p,
body.dark-mode .professional-services-cta small {
    color: #b0b0b0 !important;
}

body.dark-mode .feature {
    background: #222831 !important;
    border-color: #444 !important;
}

body.dark-mode .feature strong {
    color: #a0a000 !important;
}

body.dark-mode .feature p {
    color: #b0b0b0 !important;
}

body.dark-mode .cta-button {
    background: #a0a000 !important;
}

body.dark-mode .cta-button:hover {
    background: #8a8a00 !important;
}

body.dark-mode .green-initiative-banner {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%) !important;
    border-color: #388e3c !important;
}

body.dark-mode .green-text strong {
    color: #a5d6a7 !important;
}

body.dark-mode .green-text small {
    color: #e8f5e9 !important;
}

body.dark-mode .green-learn-more {
    color: #a5d6a7 !important;
    border-color: #a5d6a7 !important;
}

body.dark-mode .green-learn-more:hover {
    background: #a5d6a7 !important;
    color: #1b5e20 !important;
}

body.dark-mode .clear-search:hover {
    background: lightgray !important;
}

/* Dark mode language switcher */
body.dark-mode .language-switcher-nav {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .language-switcher-nav .language-link {
    color: #bbb;
}

body.dark-mode .language-switcher-nav .language-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

body.dark-mode .language-switcher-nav .language-link.active {
    background: #808000;
    color: white;
}

body.dark-mode .language-switcher-nav .language-separator {
    color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .mobile-language-switcher {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .mobile-language-switcher span {
    color: #eee;
}

body.dark-mode .mobile-language-link {
    background: rgba(255, 255, 255, 0.1);
    color: #ddd;
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .mobile-language-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .mobile-language-link.active {
    background: #808000;
    color: white;
}

/* ============================================================
   RESPONSIVE DESIGN - PROPERLY FIXED
   ============================================================ */
@media (max-width: 1199px) {
    .nav-menu-left {
        margin-right: 0px;
    }

    .nav-menu-right {
        margin-left: 80px;
    }

    .nav-item {
        font-size: 0.75rem;
        padding: 6px 8px;
    }

    .language-switcher-nav {
        font-size: 11px;
        height: 26px;
    }

    .language-switcher-nav .language-link {
        padding: 2px 8px;
        font-size: 11px;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .sidebar {
        order: -1;
    }
}

/* Switch to mobile menu earlier to prevent overlaps */
@media (max-width: 1024px) {

    /* Hide desktop navigation */
    .nav-menu {
        display: none !important;
    }

    .green-text small {
        max-width: 600px;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        order: 1;
        margin-right: auto;
    }

    .logo-container {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        order: 2;
        /* We don't need order if we use absolute, but we set it to 2 for safety */
    }

    /* Show dark mode toggle on right */
    .dark-mode-toggle-container {
        order: 3;
        margin-left: auto;
    }

    /* Adjust main navigation for mobile */
    .main-navigation {
        justify-content: space-between;
        padding: 20px 15px 0 15px;
        min-height: 70px;
    }

    .mobile-menu-overlay.active {
        display: block;
    }

    .mobile-menu-content.active {
        display: block;
    }

    .site-logo {
        max-width: 50px;
    }

    header {
        margin-top: 1vh;
    }

    #darkModeToggle {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 768px) {
    .search-input-container #searchResultsContainer {
        /* Align perfectly with the left edge of the search input field */
        left: 0;
        /* width: calc(100% + 83px); */
        max-width: none;
        right: auto;
        top: calc(100% + 6px);
        transform: none;
        /* remove any desktop translations */
    }

    .about-container {
        padding: 20px 15px;
    }

    .about-header {
        margin-bottom: 30px;
    }

    .about-header h1 {
        font-size: 2rem;
    }

    .social-links {
        grid-template-columns: 1fr;
    }

    /* Purged Mobile Header */

    .expertise-tags {
        justify-content: center;
    }

    .service-features {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .professional-services-cta {
        padding: 15px;
        margin: 20px 0;
    }

    .quality-notice {
        margin: 10px;
        padding: 10px;
    }
}

@media (max-width: 640px) {
    .search-input {
        padding: 10px 40px;
        font-size: 0.9rem;
    }

    .contribution-note {
        font-size: 0.8rem;
        color: #666;
        margin-top: 10px;
        font-style: italic;
        margin-left: auto;
        margin-right: auto;
    }

    .engagement-options {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .engagement-btn {
        width: auto;
        max-width: none;
        display: block;
        text-align: center;
        /* Keep any other existing .engagement-btn styles */
    }

    .footer-links {
        gap: 10px;
    }

    .search-button {
        padding: 10px 20px;
    }

    .results {
        margin: 15px;
        padding: 15px;
    }

    .word-name {
        font-size: 0.9rem;
    }

    .word-page-title {
        font-size: 2.2rem;
    }

    .site-title {
        font-size: 1.1rem;
    }

    .about-header h1 {
        font-size: 1.8rem;
    }

    .profile-header h2 {
        font-size: 1.5rem;
    }

    .social-section,
    .facebook-section,
    .contact-widget {
        padding: 20px;
    }

    .pronunciation-section {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 8px 10px;
    }

    .ipa-pronunciation {
        font-size: 0.9rem;
    }

    .ipa-text {
        font-size: 0.75rem;
        max-width: 150px;
        padding: 3px 6px;
    }

    .audio-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        gap: 6px;
    }

    .audio-btn svg {
        width: 14px;
        height: 14px;
    }

    .green-initiative-banner {
        flex-direction: column;
        text-align: left;
        gap: 15px;
    }

    .green-content {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-navigation {
        padding: 20px 10px 0 10px;
        min-height: 60px;
    }

    .site-logo {
        max-width: 45px;
    }

    .mobile-menu-content {
        width: 250px;
        padding: 30px 20px 20px 20px;
    }

    #darkModeToggle {
        width: 32px;
        height: 32px;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .mobile-nav-items {
        gap: 12px;
    }

    .mobile-nav-item {
        font-size: 0.9rem;
        padding: 10px 14px;
    }

    .search-input-container #searchResultsContainer {
        max-width: none;
        /* left: -46px; */
        top: calc(100% + 6px);
        border-radius: 12px;
        width: calc(100%);
    }

    .search-button {
        padding: 10px 10px;
    }

    .source-badge {
        margin: 10px;
        padding: 8px;
    }

    .professional-services-cta {
        margin: 15px 0;
        padding: 12px;
    }

    .quality-notice {
        margin: 5px;
        padding: 8px;
    }

    .pronunciation-section {
        gap: 8px;
        padding: 6px 8px;
    }

    .ipa-pronunciation strong {
        font-size: 0.9rem;
    }

    .ipa-text {
        max-width: 120px;
        font-size: 0.7rem;
    }

    .audio-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .audio-btn svg {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 360px) {
    .ipa-pronunciation strong {
        display: none;
    }

    .audio-btn span {
        display: none;
    }

    .audio-btn {
        padding: 4px 8px;
    }

    .audio-btn svg {
        margin: 0;
    }
}

/* Desktop-only styles - ensure mobile menu is hidden on desktop */
@media (min-width: 1024.02px) {

    .mobile-menu-toggle,
    .mobile-menu-overlay,
    .mobile-menu-content {
        display: none !important;
    }

    /* Ensure desktop navigation is visible */
    .nav-menu {
        display: flex !important;
    }
}

/* ========================================================== */
/* HONEYPOT SPAM PROTECTION STYLES */
/* ========================================================== */
.honeypot-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none;
    user-select: none;
}

/* 2. Target the Georgian language elements */
html[lang="ka"],
html[lang="ka"] body {
    /* Replace 'Noto Sans Georgian' with your font name */
    font-family: "Noto Sans Georgian", "Helvetica Neue", Arial, sans-serif;
}

/* Optional: If you want to use the Georgian font ONLY for text elements,
   and keep the original font for titles/UI: */

html[lang="ka"] p,
html[lang="ka"] .definition-text,
html[lang="ka"] .example-sentence,
html[lang="ka"] .contribution-btn,
html[lang="ka"] .btn-secondary,
html[lang="ka"] .audio-btn,
html[lang="ka"] .search-input {
    font-family: inherit;
}

html[lang="ka"] .category-tag {
    text-transform: none;
    font-size: 0.8rem;
}

/* Pronunciation loading styles */
.pronunciation-loading {
    padding: 5px 0;
    color: #666;
    font-style: italic;
}

.no-pronunciation {
    color: #999;
    font-style: italic;
}

/* The Diamond Separator */
.diamond-separator {
    color: #adb5bd;
    font-size: 1em;
    margin-left: 0px;
    margin-right: 3px;
    vertical-align: middle;
}

/* The English Text class you requested */
.definition-note-diamond {
    color: #adb5bd;
    /* Muted color so it doesn't catch primary attention */
    font-style: italic;
    font-weight: 400;
    font-size: 0.9rem;
    /* This creates the necessary gap for the semicolon */
    padding-right: 2px;
}

/* Dark Mode Support */
body.dark-mode .diamond-separator {
    color: #b0b0b0;
}

body.dark-mode .definition-note-diamond {
    color: #b0b0b0;
    /* Dimmed off-white for dark mode */
}

#searchInput {
    height: 46px;
    /* Match your current padding + font-size */
    box-sizing: border-box;
}

body,
#searchResultsContainer,
#definitionContent,
.results {
    cursor: default;
}

#searchInput,
.search-input {
    cursor: text !important;
}

/* Styling for the variant spelling notification */
.variant-note {
    font-style: italic;
    color: #666;
    margin: 5px 0px 10px 0px;
    font-size: 0.8em;
    /* border-left: 3px solid #ccc;
       padding-left: 10px;
       line-height: 1.4; */
}

/* Light Mode (Default) */
.variant-note strong {
    color: #333;
    font-weight: 600;
}

/* Dark Mode */
body.dark-mode .variant-note strong {
    color: #b0b0b0;
}

/* ---------- Page Fade-in (masks font-swap flash on language change) ---------- */
@keyframes page-fadein {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

body {
    animation: page-fadein 0.15s ease-in;
}

/* =============================================================
   CATEGORY FILTER STYLES

   Class namespaces:
     .cat-filter-*  — shared: panel, rows, search input, scrollbar
     .sbar-filter-* — search-bar trigger button + wrapper
     .defp-filter-* — definition-page trigger button + wrapper
   ============================================================= */

/* -------------------------------------------------------------
   SHARED — panel shell
   ------------------------------------------------------------- */
.cat-filter-panel {
    position: absolute;
    z-index: 200;
    min-width: 220px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.07),
        0 2px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* clip search bar corners */
}

/* -------------------------------------------------------------
   SHARED — search-within-dropdown input
   ------------------------------------------------------------- */
.cat-filter-search-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.cat-filter-search-icon {
    flex-shrink: 0;
    color: #bbb;
    pointer-events: none;
    line-height: 0;
}

.cat-filter-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.8rem;
    color: #333;
    padding: 0;
    /* reset any global input styles */
    box-shadow: none !important;
    border-radius: 0;
    height: auto;
    min-height: 0;
}

.cat-filter-search-input::placeholder {
    color: #bbb;
}

/* -------------------------------------------------------------
   SHARED — scrollable checkbox list
   ------------------------------------------------------------- */
.cat-filter-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 0;

    /* Firefox thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.cat-filter-list::-webkit-scrollbar {
    width: 4px;
}

.cat-filter-list::-webkit-scrollbar-track {
    background: transparent;
}

.cat-filter-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.cat-filter-list::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 0, 0.35);
}

/* -------------------------------------------------------------
   SHARED — individual checkbox row
   ------------------------------------------------------------- */
.cat-filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    color: #333;
    transition: background 0.1s;
    user-select: none;
    /* hide rows that don't match the search query */
}

.cat-filter-option:hover {
    /* font-size: 0.78rem; */
    font-style: italic;
}

/* -------------------------------------------------------------
   SHARED — collapsible category groups
   ------------------------------------------------------------- */
.cat-group {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.cat-group:first-of-type {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.cat-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Spacing for the new checkbox */
    padding: 7px 14px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 0.76rem;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.01em;
    transition: background 0.12s;
}

.cat-group-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

.cat-group-header::-webkit-details-marker {
    display: none;
}

.cat-group-checkbox {
    margin: 0;
    cursor: pointer;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.cat-group-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-group-chevron {
    flex-shrink: 0;
    color: #aaa;
    transition: transform 0.18s ease;
}

.cat-group[open]>.cat-group-header .cat-group-chevron {
    transform: rotate(180deg);
}

/* Indent child options slightly to visually nest under the header */

.cat-group-body .cat-filter-option {
    padding-left: 24px;
}

/* Dark mode */
body.dark-mode .cat-group {
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .cat-group-header {
    color: #bbb;
}

body.dark-mode .cat-group-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .cat-group-chevron {
    color: #666;
}

/* -------------------------------------------------------------
   SHARED — footer: divider + clear button
   ------------------------------------------------------------- */
.cat-filter-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 6px 14px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Split buttons left and right */
}

.cat-filter-check-all,
.cat-filter-clear {
    border: none;
    background: none;
    padding: 0;
    color: #aaa;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.15s;
    letter-spacing: 0.01em;
}

.cat-filter-check-all:hover,
.cat-filter-clear:hover {
    color: #808000;
}

/* -------------------------------------------------------------
   SHARED — chevron rotation when open
   ------------------------------------------------------------- */
.cat-filter-chevron {
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.cat-filter-btn-open .cat-filter-chevron {
    transform: rotate(180deg);
}

/* -------------------------------------------------------------
   SEARCH AREA WRAPPER
   Flex row that holds <form> and filter button side-by-side.
   The form retains its own internal layout untouched; filter
   button is simply an aligned sibling with a left margin.
   ------------------------------------------------------------- */
.search-area-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 1135px;
    margin-left: auto;
    margin-right: auto;
    padding-right: 300px;
    padding-left: 0;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .search-area-wrap {
        padding-right: 0;
        max-width: 100%;
    }
}

/* Filter wrapper – fixed width, same height as input */
.sbar-filter-wrapper {
    flex: 0 0 auto;
    /* do not grow or shrink */
    width: 130px;
    /* includes icon, label, count, chevron */
    height: 46px;
    /* match search-input-container height */
    position: relative;
    /* for positioning filter panel */
    margin-right: 5px;
}

/* Search form – gracefully adapts down, doesn't overstretch horizontally on tablet */
.search-form {
    flex: 0 1 700px;
    width: 100%;
    max-width: 700px;
    position: relative;
    /* for positioning results container */
}

/* Filter button – fills the wrapper, content spaced */
.sbar-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    /* fill wrapper height */
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sbar-filter-btn:hover {
    background: #f8f9fa;
    border-color: #808000;
    /* transform: scale(1.05); */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Count badge beside the label text */
.sbar-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #808000;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    margin-left: 1px;
}

/* Panel anchored below the search-bar filter button */
.sbar-filter-wrapper .cat-filter-panel {
    top: calc(100% + 6px);
    left: 0;
    right: auto;
}

/* =============================================================
   DEFINITION PAGE FILTER
   ============================================================= */
.defp-filter-wrapper {
    margin-top: 10px;
    margin-bottom: 5px;
    position: relative;
    width: 100%;
    max-width: 200px;
}

.defp-filter-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: 30px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: #202124;
    transition: all 0.3s ease;
    font-family: inherit;
}

.defp-filter-btn:hover {
    background: #f8f9fa;
    border-color: #808000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.defp-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #808000;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    margin-left: auto;
}

.defp-filter-wrapper .cat-filter-panel {
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
}

/* =============================================================
   MOBILE (≤767px) – COMPACT FILTER, RESPONSIVE FORM
   ============================================================= */
@media (max-width: 767px) {
    .search-area-wrap {
        gap: 5px;
        padding-right: 0px;
    }

    .green-text small {
        max-width: 450px;
    }

    .green-initiative-banner {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
    }

    .green-content {
        display: flex;
        flex-direction: row;
        gap: 8px;
    }

    .green-learn-more {
        margin: 0 auto;
        display: inline-block;
        width: fit-content;
    }

    .sbar-filter-wrapper {
        width: 46px;
        /* match input height on mobile */
        height: 46px;
        margin-right: 5px;
        /* Clear desktop margin so left calculation is pixel perfect */
    }

    .sbar-filter-btn {
        justify-content: center;
        /* centre icon/count/chevron */
        padding: 0 5px;
    }

    .sbar-filter-btn #sbarFilterLabel {
        display: none;
        /* hide "Categories" text */
    }

    .search-form {
        flex: 1 1 auto;
        /* take remaining space */
        width: auto;
        /* override fixed width */
        min-width: 200px;
        /* prevent excessive shrinking */
        max-width: 600px;
    }
}

/* Custom Checkbox Color */
.cat-filter-checkbox,
.cat-group-checkbox {
    accent-color: #808000;
}

/* =============================================================
   MOBILE (≤480px) – DEFINITION WRAPPING FOR TAGS
   Float approach: tag floats left, meaning text runs beside it,
   wrapped lines go to the full left margin (true run-in style).
   ============================================================= */
@media (max-width: 480px) {
    .definition-content {
        display: flow-root;
        /* new BFC: contains the float cleanly */
    }

    .definition-content .category-tag {
        float: left;
        margin-right: 6px;
        padding: 2px 6px;
        margin-top: 0px;
        font-size: 0.8rem;
    }

    .search-area-wrap {
        padding-left: 5px;
        padding-right: 5px;
        gap: 5px;
    }
}

/* ---------- Russian Dictionary HTML Formatting ---------- */
.ru-dict-entry {
    font-family: "Roboto", "Noto Sans", "Segoe UI", "Tahoma", sans-serif;
    color: #333;
    text-rendering: optimizeLegibility;
    font-variant-ligatures: none;
}

.ru-pronunciation {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 12px;
}

.ru-pos-group {
    margin-bottom: 15px;
}

.ru-pos {
    font-weight: bold;
    color: #808000;
    display: block;
    margin-bottom: 6px;
    font-size: 1.05em;
    /* border-bottom: 1px dashed #ccc; */
    padding-bottom: 3px;
}

.ru-meanings-list {
    margin: 0 0 0 20px;
    padding: 0;
    list-style-type: decimal;
}

.ru-meanings-list-alpha {
    list-style-type: lower-alpha;
}

.ru-meanings-list li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.ru-example {
    display: block;
    color: #555;
    margin-top: 3px;
    padding-left: 10px;
    /*border-left: 2px solid #ddd; */
}

.ru-term {
    font-weight: 600;
    color: #2c3e50;
    font-style: italic;
}

.ru-note {
    font-size: 0.85em;
    color: #888;
    font-style: italic;
    margin-right: 4px;
}

.ru-synonyms {
    margin-top: 10px;
    color: #666;
    font-size: 0.92em;
}

.ru-idioms-list {
    margin-top: 10px;
}

.ru-idioms-list p {
    margin: 0 0 8px;
}

.ru-idioms-list p:last-child {
    margin-bottom: 0;
}

/* User Profile & Login Styles (Matching Nav Items) */
.user-profile-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px;
}

.google-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #3c4043;
    font-weight: 500;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    background: #ffffff;
    border: 1px solid #dadce0;
    cursor: pointer;
    box-shadow:
        0 1px 2px 0 rgba(60, 64, 67, 0.3),
        0 1px 3px 1px rgba(60, 64, 67, 0.15);
    font-family: "Inter", sans-serif;
    text-transform: uppercase;
    margin-left: 3px;
}

.google-login-btn:hover {
    background-color: #f8f9fa;
    border-color: #d2dce0;
    box-shadow:
        0 1px 3px 0 rgba(60, 64, 67, 0.3),
        0 4px 8px 3px rgba(60, 64, 67, 0.15);
    color: #202124;
}

.google-login-btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 5px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #202124;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.user-badge:hover {
    background-color: rgba(128, 128, 0, 0.05);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #808000;
}

.user-avatar-initial {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #808000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #888;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.logout-link:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Mobile Adjustments for User Profile */
@media (max-width: 768px) {

    /* Restored: user-name is now visible on mobile as requested */
    .user-badge .user-name {
        display: inline-block;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-user-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(0, 0, 0, 0.03);
        padding: 10px 15px;
        border-radius: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .mobile-user-row .user-badge {
        padding: 5px 0;
        flex-grow: 1;
    }

    .mobile-user-row .logout-link {
        background: rgba(239, 68, 68, 0.1);
        color: #ef4444;
        padding: 6px 12px;
        border-radius: 6px;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        text-decoration: none;
        width: auto;
        height: auto;
    }
}

/* =============================================================
   AI CHAT ASSISTANT WIDGET
   ============================================================= */
.ai-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #808000;
    color: white;
    font-size: 28px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition:
        transform 0.3s ease,
        background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-btn:hover {
    /*  transform: scale(1.1); */
    background-color: #999900;
}

.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 120px);
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.ai-chat-window.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.ai-chat-header {
    background: #808000;
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

.ai-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-model-selector {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.35);
    outline: none;
    cursor: pointer;
}

.ai-model-selector option {
    color: #202124;
    background: #fff;
}

.ai-chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.ai-chat-close-btn:hover {
    opacity: 1;
}

.ai-chat-history {
    flex: 1 1 auto;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
}

.ai-message {
    display: flex;
    width: 100%;
}

.ai-message-user {
    justify-content: flex-end;
}

.ai-message-model,
.ai-message-system {
    justify-content: flex-start;
}

.ai-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-message-user .ai-bubble {
    background: #ebebdb;
    color: #808000;
    border-bottom-right-radius: 4px;
}

.ai-message-model .ai-bubble,
.ai-message-system .ai-bubble {
    background: #ffffff;
    color: #202124;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ai-message-system .ai-bubble {
    font-style: italic;
    color: #5f6368;
}

.ai-chat-input-area {
    padding: 15px;
    background: #ffffff;
    border-top: 1px solid #eee;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.ai-chat-input {
    flex: 1 1 auto;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #f8f9fa;
    color: #202124;
}

.ai-chat-input:focus {
    border-color: #808000;
    background: #ffffff;
}

.ai-chat-send-btn {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #808000;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.ai-chat-send-btn:hover:not(:disabled) {
    background: #999900;
}

.ai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Typing Indicator Animation */
.ai-typing-indicator span {
    display: inline-block;
    animation: aiBlink 1.4s infinite both;
    font-size: 1.2rem;
    line-height: 1;
}

.ai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes aiBlink {
    0% {
        opacity: 0.2;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0.2;
    }
}

/* =============================================================
   WELCOME MESSAGE (HOME PAGE)
   ============================================================= */
.welcome-message {
    padding: 20px 0 15px;
    text-align: center;
}

.welcome-message h2 {
    font-size: 1.4rem;
    color: #202124;
    margin-bottom: 5px;
    font-weight: 600;
}

.welcome-message p {
    color: #5f6368;
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* =============================================================
   PARTIAL NAVIGATION — Progress Bar & Content Transitions
   ============================================================ */

/* ---------- Progress Bar (YouTube / GitHub style) ---------- */
#nav-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #808000, #a0a000, #c0c000);
    z-index: 99999;
    pointer-events: none;
    transition: none;
    opacity: 0;
}

#nav-progress-bar.loading {
    opacity: 1;
    animation: progressBarGrow 2s ease-out forwards;
}

#nav-progress-bar.done {
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
}

@keyframes progressBarGrow {
    0% {
        width: 0;
    }

    20% {
        width: 30%;
    }

    50% {
        width: 60%;
    }

    80% {
        width: 85%;
    }

    100% {
        width: 95%;
    }
}

/* ---------- Partial Content Fade Transitions ---------- */
#definitionContent.partial-fade-out {
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

#definitionContent.partial-fade-in {
    animation: partialFadeIn 0.3s ease-out;
}

@keyframes partialFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Dark Mode Overrides ---------- */
body.dark-mode #nav-progress-bar {
    background: linear-gradient(90deg, #a0a000, #c0c000, #e0e000);
}

body.dark-mode .welcome-message h2 {
    color: #e8eaed;
}

body.dark-mode .welcome-message p {
    color: #b0b0b0;
}

/* AI Chat Dark Mode */
body.dark-mode .ai-chat-window {
    background: #1e1e1e;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.dark-mode .ai-chat-history {
    background: #121212;
}

body.dark-mode .ai-message-model .ai-bubble,
body.dark-mode .ai-message-system .ai-bubble {
    background: #2a2a2a;
    color: #e8eaed;
}

body.dark-mode .ai-message-system .ai-bubble {
    color: #9aa0a6;
}

body.dark-mode .ai-message-user .ai-bubble {
    background: #1a3a5f;
    color: #e8eaed;
}

body.dark-mode .ai-chat-input-area {
    background: #1e1e1e;
    border-top-color: #333;
}

body.dark-mode .ai-chat-input {
    background: #2a2a2a;
    border-color: #444;
    color: #e8eaed;
}

body.dark-mode .ai-chat-input:focus {
    background: #1e1e1e;
    border-color: #a0a000;
}

/* iPad / medium tablets — constrain chat window */
@media (max-width: 1024px) {
    .ai-chat-window {
        width: 340px;
        height: 480px;
    }
}

/* Mobile phones — full-screen chat */
@media (max-width: 480px) {
    .ai-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        /* dvh gives the *real* visible height on mobile browsers with
           a dynamic URL bar (Chrome, Safari). Falls back to vh. */
        height: 100dvh;
        height: 100vh;
        /* fallback for older browsers */
        max-height: 100dvh;
        max-height: 100vh;
        max-width: 100vw;
        border-radius: 0;
    }

    @supports (height: 100dvh) {
        .ai-chat-window {
            height: 100dvh;
            max-height: 100dvh;
        }
    }

    .ai-chat-window.hidden {
        transform: translateY(100%);
    }

    .ai-title-text {
        display: none;
    }

    .ai-chat-header {
        padding: 10px 12px;
        gap: 6px;
    }

    /* Let the icon shrink a bit on very narrow screens */
    .ai-icon {
        flex-shrink: 0;
        font-size: 22px;
    }

    /* Keep the model selector visible and tappable */
    .ai-model-selector {
        flex-shrink: 1;
        min-width: 0;
        max-width: 120px;
        font-size: 0.75rem;
        padding: 4px 6px;
    }

    /* Prevent the close button from being pushed off-screen */
    .ai-chat-close-btn {
        flex-shrink: 0;
    }
}

.modal-feedback {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.modal-feedback.success {
    color: #1e7e34;
}

.modal-feedback.error {
    color: #c82333;
}

.modal-feedback.info {
    color: #444;
}

body.dark-mode .modal-success-title {
    color: #f3f3f3;
}

body.dark-mode .modal-success-message {
    color: #d3d3d3;
}

.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.15rem 0;
}