/**
 * ABM Multilang — Language Switcher Styles
 * Beautiful, responsive, RTL-aware
 */

/* =========================================================================
   Header Switcher (Desktop)
   ========================================================================= */

.abm-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 100;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Toggle Button */
.abm-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1.5px solid rgba(128, 128, 128, 0.25);
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    transition: all 0.25s ease;
    line-height: 1;
    white-space: nowrap;
}

.abm-switcher-toggle:hover {
    border-color: rgba(128, 128, 128, 0.5);
    background: rgba(128, 128, 128, 0.06);
}

.abm-switcher-toggle:focus {
    outline: 2px solid rgba(0, 115, 170, 0.5);
    outline-offset: 2px;
}

.abm-switcher-current {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Flag Images */
.abm-switcher-flag {
    display: inline-block;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

/* Language Code */
.abm-switcher-code {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Arrow */
.abm-switcher-arrow {
    transition: transform 0.25s ease;
    flex-shrink: 0;
    opacity: 0.6;
}

.abm-switcher.is-open .abm-switcher-arrow {
    transform: rotate(180deg);
}

/* Dropdown */
.abm-switcher-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.abm-switcher.is-open .abm-switcher-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Options */
.abm-switcher-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 400;
    transition: background-color 0.15s ease;
    line-height: 1.3;
}

.abm-switcher-option:hover {
    background: #f5f5f5;
    color: #1a1a1a;
    text-decoration: none;
}

.abm-switcher-option:focus {
    outline: 2px solid rgba(0, 115, 170, 0.5);
    outline-offset: -2px;
    background: #f5f5f5;
}

.abm-switcher-name {
    flex: 1;
    font-weight: 500;
}

.abm-switcher-code-small {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* =========================================================================
   RTL Support
   ========================================================================= */

.rtl .abm-switcher-dropdown {
    left: auto;
    right: 0;
}

.rtl .abm-switcher-toggle {
    direction: rtl;
}

/* =========================================================================
   Floating Mobile Switcher
   ========================================================================= */

.abm-mobile-switcher {
    display: none; /* Hidden on desktop, shown on mobile */
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9998;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 2px solid rgba(0, 0, 0, 0.06);
    flex-direction: column;
    gap: 2px;
}

.rtl .abm-mobile-switcher {
    left: auto;
    right: 20px;
}

.abm-mobile-switcher:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2), 0 3px 10px rgba(0, 0, 0, 0.12);
    text-decoration: none;
}

.abm-mobile-switcher:active {
    transform: scale(0.96);
}

.abm-mobile-switcher-flag {
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.abm-mobile-switcher-code {
    font-size: 9px;
    font-weight: 700;
    color: #555;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
}

/* =========================================================================
   Inline Switcher (shortcode/widget)
   ========================================================================= */

.abm-switcher-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.abm-switcher-inline-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
}

.abm-switcher-inline-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a1a;
    text-decoration: none;
}

.abm-switcher-inline-item.abm-active {
    background: rgba(0, 115, 170, 0.08);
    color: #0073aa;
    border-color: rgba(0, 115, 170, 0.2);
    font-weight: 600;
}

.abm-switcher-inline-label {
    line-height: 1;
}

/* Flags-only style */
.abm-switcher-flags .abm-switcher-inline-item {
    padding: 5px 8px;
}

/* =========================================================================
   Dark Header Compatibility (Goya theme)
   ========================================================================= */

.header-text-light .abm-switcher-toggle {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.header-text-light .abm-switcher-toggle:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

/* Transparent header */
.transparent-header .site-header:not(.is-sticky) .abm-switcher-toggle {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.transparent-header .site-header:not(.is-sticky) .abm-switcher-toggle:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
}

/* Sticky header */
.site-header.is-sticky .abm-switcher-toggle {
    color: inherit;
    border-color: rgba(128, 128, 128, 0.25);
}

/* Top bar */
.top-bar .abm-switcher-toggle {
    padding: 4px 10px;
    font-size: 12px;
    border: none;
    background: transparent;
}

.top-bar .abm-switcher-toggle:hover {
    background: rgba(128, 128, 128, 0.1);
}

.top-bar .abm-switcher-flag {
    width: 16px;
    height: 12px;
}

/* Side menu / fullscreen menu */
.side-mobile-menu .abm-switcher,
.side-fullscreen-menu .abm-switcher {
    display: flex;
    margin: 10px 0;
}

.side-mobile-menu .abm-switcher-toggle,
.side-fullscreen-menu .abm-switcher-toggle {
    border: none;
    padding: 8px 0;
    font-size: 14px;
}

.side-mobile-menu .abm-switcher-dropdown,
.side-fullscreen-menu .abm-switcher-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    background: transparent;
    opacity: 1;
    visibility: visible;
    transform: none;
    padding: 0;
    display: none;
}

.side-mobile-menu .abm-switcher.is-open .abm-switcher-dropdown,
.side-fullscreen-menu .abm-switcher.is-open .abm-switcher-dropdown {
    display: block;
}

.side-mobile-menu .abm-switcher-option,
.side-fullscreen-menu .abm-switcher-option {
    color: inherit;
    padding: 8px 10px;
}

/* Footer bar */
.footer-bar .abm-switcher-toggle {
    border: none;
    padding: 4px 8px;
    font-size: 12px;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 991px) {
    /* Show floating mobile switcher */
    .abm-mobile-switcher {
        display: flex;
    }

    /* Adjust header switcher for tablet */
    .abm-switcher-header .abm-switcher-toggle {
        padding: 5px 10px;
    }

    .abm-switcher-header .abm-switcher-name {
        display: none;
    }
}

@media (max-width: 767px) {
    /* Hide the header switcher text on small mobile, keep it compact */
    .abm-switcher-header .abm-switcher-code {
        font-size: 12px;
    }

    /* Ensure dropdown doesn't overflow screen */
    .abm-switcher-dropdown {
        min-width: 160px;
        right: 0;
        left: auto;
    }

    .rtl .abm-switcher-dropdown {
        right: auto;
        left: 0;
    }

    /* Floating switcher adjustments */
    .abm-mobile-switcher {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
    }

    .rtl .abm-mobile-switcher {
        left: auto;
        right: 16px;
    }
}

/* =========================================================================
   Animations
   ========================================================================= */

@keyframes abm-switcher-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.abm-mobile-switcher:focus-visible {
    animation: abm-switcher-bounce 0.3s ease;
    outline: 3px solid rgba(0, 115, 170, 0.5);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .abm-switcher-dropdown,
    .abm-switcher-arrow,
    .abm-mobile-switcher,
    .abm-switcher-toggle {
        transition: none !important;
    }
}

/* =========================================================================
   Print — hide switcher
   ========================================================================= */

@media print {
    .abm-switcher,
    .abm-mobile-switcher,
    .abm-switcher-inline {
        display: none !important;
    }
}
