/**
 * TeeqCore Language Switcher Styles
 *
 * Basic styling for the multilingual language switcher component.
 *
 * @package     TeeqCore
 * @author      TechTeeq
 * @since       1.0.0
 */

/* =============================================================================
   LANGUAGE SWITCHER BASE STYLES
   ============================================================================= */

.language-switcher {
    position: relative;
    display: inline-block;
    font-family: inherit;
    z-index: 1000;
}

.auto-language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: #fff;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   DROPDOWN SWITCHER
   ============================================================================= */

.language-switcher[data-style="dropdown"] .language-dropdown {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    min-width: 120px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 35px;
}

.language-switcher[data-style="dropdown"] .language-dropdown:hover {
    border-color: #0073aa;
}

.language-switcher[data-style="dropdown"] .language-dropdown:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

/* =============================================================================
   FLAGS SWITCHER
   ============================================================================= */

.language-switcher[data-style="flags"] .language-flags {
    display: flex;
    gap: 17px;
    flex-wrap: wrap;
}

.language-switcher[data-style="flags"] .language-flag {
    background: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.language-switcher[data-style="flags"] .language-flag:hover {opacity: 1;}

.language-switcher[data-style="flags"] .language-flag.active {
    display: none;
}

.language-switcher[data-style="flags"] .flag-icon {
    font-size: 16px;
    line-height: 1;
}

.language-switcher[data-style="flags"] .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============================================================================
   TEXT SWITCHER
   ============================================================================= */

.language-switcher[data-style="text"] .language-text {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.language-switcher[data-style="text"] .language-link {
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 6px 12px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.language-switcher[data-style="text"] .language-link:hover {
    color: #0073aa;
    border-color: #0073aa;
    background-color: rgba(0, 115, 170, 0.05);
}

.language-switcher[data-style="text"] .language-link.active {
    color: #fff;
    background-color: #0073aa;
    border-color: #0073aa;
}

/* =============================================================================
   FLAG ICONS (Basic Unicode Flags)
   ============================================================================= */

.flag-icon {
    display: inline-block;
    font-style: normal;
}

/* Unicode flag emojis as fallback */
.flag-icon-en::before { content: "ðŸ‡ºðŸ‡¸"; }
.flag-icon-ar::before { content: "ðŸ‡¸ðŸ‡¦"; }
.flag-icon-es::before { content: "ðŸ‡ªðŸ‡¸"; }
.flag-icon-fr::before { content: "ðŸ‡«ðŸ‡·"; }
.flag-icon-de::before { content: "ðŸ‡©ðŸ‡ª"; }
.flag-icon-he::before { content: "ðŸ‡®ðŸ‡±"; }
.flag-icon-it::before { content: "ðŸ‡®ðŸ‡¹"; }
.flag-icon-pt::before { content: "ðŸ‡µðŸ‡¹"; }
.flag-icon-ru::before { content: "ðŸ‡·ðŸ‡º"; }
.flag-icon-zh::before { content: "ðŸ‡¨ðŸ‡³"; }
.flag-icon-ja::before { content: "ðŸ‡¯ðŸ‡µ"; }
.flag-icon-ko::before { content: "ðŸ‡°ðŸ‡·"; }

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 768px) {
    .auto-language-switcher {
        top: 10px;
        right: 10px;
        padding: 8px;
    }
    
    .language-switcher[data-style="dropdown"] .language-dropdown {
        min-width: 100px;
        font-size: 13px;
        padding: 6px 10px;
        padding-right: 30px;
    }
    
    .language-switcher[data-style="text"] .language-link {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .language-switcher[data-style="flags"] .language-flag {
        width: 28px;
        height: 20px;
    }
}

/* =============================================================================
   RTL SUPPORT
   ============================================================================= */

.rtl .auto-language-switcher {
    right: auto;
    left: 20px;
}

.rtl .language-switcher[data-style="dropdown"] .language-dropdown {
    background-position: left 10px center;
    padding-right: 12px;
    padding-left: 35px;
}

@media (max-width: 768px) {
    .rtl .auto-language-switcher {
        right: auto;
        left: 10px;
    }
}

/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */

.language-switcher button:focus,
.language-switcher select:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.language-switcher [aria-current] {
    font-weight: bold;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .language-switcher[data-style="flags"] .language-flag {
        border-width: 2px;
    }
    
    .language-switcher[data-style="text"] .language-link {
        border-width: 2px;
    }
    
    .language-switcher[data-style="dropdown"] .language-dropdown {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .language-switcher * {
        transition: none !important;
    }
}

/* =============================================================================
   ADMIN BAR COMPATIBILITY
   ============================================================================= */

body.admin-bar .auto-language-switcher {
    top: 52px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .auto-language-switcher {
        top: 56px;
    }
}

/* =============================================================================
   THEME INTEGRATION
   ============================================================================= */

/* If theme has a header navigation, style accordingly */
.site-header .language-switcher {
    margin-left: 15px;
}

.site-header .language-switcher[data-style="dropdown"] .language-dropdown {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: inherit;
}

.site-header .language-switcher[data-style="text"] .language-link {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: inherit;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .auto-language-switcher {
        background: #1a1a1a;
        color: #fff;
    }
    
    .language-switcher[data-style="dropdown"] .language-dropdown {
        background: #1a1a1a;
        border-color: #555;
        color: #fff;
    }
    
    .language-switcher[data-style="text"] .language-link {
        background: #1a1a1a;
        border-color: #555;
        color: #fff;
    }
    
    .language-switcher[data-style="flags"] .language-flag {
        border-color: #555;
    }
}

/* Flag Images Styling */
.language-switcher .flag-img {
    display: inline-block;
    vertical-align: middle;
    border-radius: 2px;
    object-fit: cover;
}

.language-switcher[data-style="flags"] .flag-img {
    width: 22px;
    height: auto;
}

.language-switcher[data-style="text"] .flag-img {
    width: 20px;
    height: 15px;
    margin-right: 6px;
}

.language-switcher .flag-emoji {
    font-size: 1.2em;
    vertical-align: middle;
}

.language-switcher .flag-fallback {
    font-size: 1.2em;
    vertical-align: middle;
    opacity: 0.7;
}

/* Hover effects for flag images */
.language-switcher .language-flag:hover .flag-img,
.language-switcher .language-link:hover .flag-img {
    transition: transform 0.2s ease;
}
