/* Home Button Styles */
.home-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.home-button:hover {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
    text-decoration: none;
}

.home-icon {
    font-size: 20px;
}

/* Dark theme support for home button */
body.is-preload .home-button,
.dark-theme .home-button {
    background: rgba(50, 50, 50, 0.95);
    border-color: #444;
}

/* RTL positioning for home button */
html[dir="rtl"] .home-button {
    right: auto;
    left: 20px;
}

/* Language Switcher Styles */
.language-switcher {
    position: fixed;
    bottom: 20px;
    right: 74px;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* Hidden state when scrolled past first viewport */
.language-switcher.scroll-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
}

.language-toggle {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: #333;
}

.language-toggle:hover {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.globe-icon {
    font-size: 18px;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.language-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    min-width: 180px;
}

.language-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    white-space: nowrap;
    transition: background 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
}

.language-option:hover {
    background: #f5f5f5;
    text-decoration: none;
    color: #333;
}

.language-option.active {
    background: #e3f2fd;
    font-weight: bold;
}

/* RTL adjustments for language menu */
/* Note: Individual language options with dir="rtl" are NOT right-aligned here.
   When on a LTR page, all languages should be left-aligned.
   When on a RTL page (html[dir="rtl"]), the rule below handles alignment. */

/* Dark theme support (for pages with dark background) */
body.is-preload .language-toggle,
.dark-theme .language-toggle {
    background: rgba(50, 50, 50, 0.95);
    color: white;
    border-color: #444;
}

body.is-preload .language-menu,
.dark-theme .language-menu {
    background: #333;
}

body.is-preload .language-option,
.dark-theme .language-option {
    color: white;
}

body.is-preload .language-option:hover,
.dark-theme .language-option:hover {
    background: #444;
    color: white;
}

body.is-preload .language-option.active,
.dark-theme .language-option.active {
    background: #1a5276;
}

/* Scrollbar styling for language menu */
.language-menu::-webkit-scrollbar {
    width: 6px;
}

.language-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.language-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.language-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Position language switcher at the edge when on home page (no home button) */
.language-switcher.home-page {
    right: 20px;
}

/* RTL positioning */
html[dir="rtl"] .language-switcher {
    right: auto;
    left: 74px;
}

html[dir="rtl"] .language-switcher.home-page {
    left: 20px;
}

html[dir="rtl"] .language-menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .language-option {
    text-align: right;
}
