/**
 * Hydori Language Switcher — frontend styles.
 * All selectors scoped to .hydori-language-switcher to prevent theme conflicts.
 *
 * @since 2.7.0
 */

.hydori-language-switcher {
    font-size: 14px;
    line-height: 1.5;
}

/* ---- List style ---- */
.hydori-switcher-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}

.hydori-lang-item {
    display: inline-block;
}

.hydori-lang-item-current .hydori-lang-current {
    font-weight: 600;
    color: inherit;
    cursor: default;
}

.hydori-language-switcher .hydori-lang-link {
    text-decoration: none;
    color: currentColor;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.hydori-language-switcher .hydori-lang-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ---- Inline style ---- */
.hydori-switcher-inline .hydori-switcher-label {
    font-weight: 600;
    margin-right: 4px;
}

/* ---- Buttons style ---- */
.hydori-switcher-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hydori-lang-btn {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    color: currentColor;
    opacity: 0.65;
    transition: opacity 0.15s ease;
}

.hydori-lang-btn:hover {
    opacity: 1;
}

.hydori-lang-btn-current {
    opacity: 1;
    font-weight: 600;
    cursor: default;
}

/* ---- Editor placeholder ---- */
.hydori-switcher-placeholder {
    padding: 8px 12px;
    background: #f0f0f1;
    border-radius: 4px;
    color: #646970;
    font-size: 13px;
    font-style: italic;
}

/* =========================================================
   Dropdown style
   ========================================================= */

.hydori-switcher-dropdown {
    position: relative;
    display: inline-block;
    font-family: inherit;
}

/* Trigger button ----------------------------------------- */
.hydori-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: inherit;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.hydori-dropdown-trigger:hover,
.hydori-switcher-dropdown.hydori-dropdown-open .hydori-dropdown-trigger {
    background: #f9fafb;
    border-color: #9ca3af;
}

.hydori-dropdown-trigger:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Flag emoji in the trigger */
.hydori-dropdown-flag {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
}

/* Language code (e.g. "EN") */
.hydori-dropdown-code {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Chevron — border-trick arrow, rotates on open/close */
.hydori-dropdown-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.hydori-dropdown-chevron::before {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    /* Default: chevron points DOWN (∨) — list opens below */
    transform: rotate( 45deg );
    margin-top: -2px;
    transition: transform 0.2s ease, margin-top 0.2s ease;
}

/* When open: chevron points UP (∧) */
.hydori-switcher-dropdown.hydori-dropdown-open .hydori-dropdown-chevron::before {
    transform: rotate( -135deg );
    margin-top: 3px;
}

/* Options list ------------------------------------------- */
.hydori-dropdown-list {
    position: absolute;
    top: calc( 100% + 6px );
    left: 0;
    min-width: 210px;
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.10 ), 0 2px 6px rgba( 0, 0, 0, 0.06 );
    overflow: hidden;
    z-index: 9999;

    /* Hidden state — starts just above its open position, slides down on open */
    opacity: 0;
    visibility: hidden;
    transform: translateY( -6px );
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    pointer-events: none;
}

/* Open state */
.hydori-switcher-dropdown.hydori-dropdown-open .hydori-dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY( 0 );
    pointer-events: auto;
}

/* Individual option row ---------------------------------- */
.hydori-dropdown-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    font-size: 14px;
    transition: background 0.1s ease;
    border-bottom: 1px solid #f2f4f7;
}

.hydori-dropdown-option:last-child {
    border-bottom: none;
}

.hydori-dropdown-option:hover {
    background: #f9fafb;
    text-decoration: none;
    color: inherit;
}

.hydori-dropdown-option-flag {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.hydori-dropdown-option-name {
    font-size: 14px;
    color: #101828;
    font-weight: 400;
}

/* =========================================================
   Nav menu item
   The theme controls sub-menu layout; these rules only ensure
   flag emoji renders cleanly and links don't break mid-word.
   ========================================================= */

.hydori-nav-lang-switcher > a,
.hydori-nav-lang-item > a {
    white-space: nowrap;
}
