/*
*********************************************************************************************
* File: language-selector.css
* Author: Madhurima Rawat
* Date: November 24, 2026
* Description:
*   Dedicated responsive stylesheet for the floating language selector of
*   "Madhurima Mindscape".
*
*   Includes:
*   - Fixed floating Language button with circular design.
*   - Bottom-right floating language selection container.
*   - Custom searchable language dropdown.
*   - Dropdown trigger button with hover effects.
*   - Search input with focus and placeholder styling.
*   - Scrollable language options with custom scrollbar.
*   - Language option hover and selected states.
*   - No search results message styling.
*   - Hidden native select for translate.js functionality.
*   - Responsive mobile layout for the language selector.
*   - Keyboard focus accessibility for interactive elements.
*
* Dependencies:
*   - CSS variables: --text-color, --h2-color, --post-action-color.
*   - Custom HTML: blog.html.
*   - Custom JavaScript: translate.js.
*   - Font Awesome: Language icon (fa-language).
*********************************************************************************************
*/

/**
 * ==========================================================
 * FLOATING LANGUAGE SELECTOR
 * ==========================================================
 *
 * Features:
 * - Fixed floating language button
 * - Bottom-right language selector panel
 * - Custom searchable language dropdown
 * - Scrollable language options
 * - Selected and hover states
 * - Hidden native select for translate.js
 * - Responsive mobile layout
 *
 * ==========================================================
 */


/* ==========================================================
   1. FLOATING LANGUAGE BUTTON
   ========================================================== */

.language-toggle {
    position: fixed;

    right: 25px;
    bottom: 25px;

    width: 55px;
    height: 55px;
    padding: 0;

    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;

    border: none;
    border-radius: 50%;

    background: var(--h2-color);
    color: var(--post-action-color);

    cursor: pointer;
    z-index: 9999;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);

    /* Always visible */
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);

    /* Smooth transitions */
    transition:
        background 0.25s ease,
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

/* Globe Icon */
.language-icon {
    display: block;
    font-size: 16px;
    line-height: 1;
}

/* Language Text */
.language-text {
    display: block;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

/* Hover */
.language-toggle:hover {
    transform: translateY(-4px);

    background: color-mix(in srgb, var(--h2-color) 75%, white);

    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.25);
}

/* Keyboard Focus */
.language-toggle:focus-visible {
    outline: 3px solid var(--text-color);
    outline-offset: 4px;
}

/* ==========================================================
   2. FLOATING LANGUAGE CONTAINER
   ========================================================== */

.translate-container {
    display: none;

    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 9998;

    width: 280px;
    max-width: calc(100vw - 32px);

    padding: 12px;

    background: #fff;
    border-radius: 12px;

    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
}

/* Show container when activated */
.translate-container.active {
    display: block;
}


/* ==========================================================
   3. CUSTOM LANGUAGE DROPDOWN
   ========================================================== */

.custom-language-dropdown {
    position: relative;
    width: 100%;
}


/* ==========================================================
   4. DROPDOWN TRIGGER BUTTON
   ========================================================== */

.language-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    padding: 11px 14px;

    border: 1px solid #ddd;
    border-radius: 8px;

    background: #fff;
    color: #222;

    font-size: 14px;
    text-align: left;

    cursor: pointer;

    transition: border-color .2s ease;
}

/* Dropdown arrow */
.language-dropdown-trigger::after {
    content: "▾";
    margin-left: 10px;
    font-size: 16px;
}

/* Trigger hover state */
.language-dropdown-trigger:hover {
    border-color: #999;
}


/* ==========================================================
   5. DROPDOWN PANEL
   ========================================================== */

.language-dropdown-panel {
    display: none;

    width: 100%;
    margin-top: 15px;
}

/* Show panel when dropdown is open */
.custom-language-dropdown.is-open .language-dropdown-panel {
    display: block;
}


/* ==========================================================
   6. LANGUAGE SEARCH INPUT
   ========================================================== */

.language-search-input {
    display: block;
    box-sizing: border-box;

    width: 100%;
    padding: 11px 12px;
    margin-bottom: 10px;

    border: 1px solid #ddd;
    border-radius: 8px;

    background: #fff;
    color: #222;

    font-size: 14px;

    outline: none;

    transition: border-color .2s ease, box-shadow .2s ease;
}

/* Search input focus state */
.language-search-input:focus {
    border-color: var(--h2-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--h2-color) 12%, transparent);
}

/* Search placeholder */
.language-search-input::placeholder {
    color: #999;
}


/* ==========================================================
   7. SCROLLABLE LANGUAGE OPTIONS
   ========================================================== */

.language-dropdown-options {
    display: block;

    width: 100%;
    max-height: 240px;

    overflow-y: auto;
    overflow-x: hidden;

    border: 1px solid #ddd;
    border-radius: 8px;

    background: #fff;

    box-shadow: 0 4px 15px rgba(0, 0, 0, .12);

    scrollbar-width: thin;
    scrollbar-color: #aaa #f1f1f1;
}


/* ==========================================================
   8. INDIVIDUAL LANGUAGE OPTIONS
   ========================================================== */

.language-dropdown-option {
    display: block;
    box-sizing: border-box;

    width: 100%;
    min-height: 40px;

    padding: 10px 12px;

    border: none;

    background: #fff;
    color: #222;

    font-size: 14px;
    text-align: left;

    cursor: pointer;

    transition: background .15s ease;
}

/* Language option hover state */
.language-dropdown-option:hover {
    background: var(--h2-color);
    color: var(--post-action-color);
}

/* Currently selected language */
.language-dropdown-option.selected {
    background: #e8e8e8;
    font-weight: 600;
}

/* Hide options that do not match the search */
.language-dropdown-option[hidden] {
    display: none !important;
}


/* ==========================================================
   9. NO SEARCH RESULTS MESSAGE
   ========================================================== */

.language-no-results {
    padding: 15px 10px;

    color: #888;
    font-size: 13px;
    text-align: center;
}

/* Hide message when results are available */
.language-no-results[hidden] {
    display: none !important;
}


/* ==========================================================
   10. CUSTOM SCROLLBAR
   ========================================================== */

/* Chrome, Edge and Safari */
.language-dropdown-options::-webkit-scrollbar {
    width: 7px;
}

.language-dropdown-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.language-dropdown-options::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 10px;
}

.language-dropdown-options::-webkit-scrollbar-thumb:hover {
    background: #777;
}


/* ==========================================================
   11. HIDDEN NATIVE SELECT
   ==========================================================
   Kept in the DOM for translate.js functionality.
   The custom dropdown is used for the visible interface.
   ========================================================== */

.translate-container select {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;

    padding: 0 !important;
    margin: -1px !important;

    overflow: hidden !important;

    clip: rect(0, 0, 0, 0) !important;

    white-space: nowrap !important;
    border: 0 !important;
}


/* ==========================================================
   12. MOBILE RESPONSIVENESS
   ========================================================== */

@media (max-width: 480px) {

    /* Floating Language Button */
    .language-toggle {
        right: 16px;
        bottom: 24px;

        width: 55px;
        height: 55px;
    }

    /* Language Container */
    .translate-container {
        right: 16px;
        bottom: 90px;

        width: 240px;
        max-width: calc(100vw - 32px);

        padding: 10px;

        border-radius: 10px;
    }

    /* Dropdown Wrapper */
    .custom-language-dropdown {
        width: 100%;
    }

    /* Dropdown Trigger - Initially visible */
    .language-dropdown-trigger {
        width: 100%;
        padding: 12px;

        font-size: 14px;
    }

    /* Dropdown Panel - Opens only after tapping trigger */
    .language-dropdown-panel {
        display: none;
        margin-top: 10px;
    }

    .custom-language-dropdown.is-open .language-dropdown-panel {
        display: block;
    }

    /* Search Input */
    .language-search-input {
        width: 100%;
        padding: 12px;

        font-size: 14px;
        margin-bottom: 8px;
    }

    /* Language Options */
    .language-dropdown-options {
        max-height: 200px;

        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Individual Options */
    .language-dropdown-option {
        min-height: 42px;
        padding: 11px 12px;

        font-size: 14px;
    }

}