/**
 * Flavor Translator - Language Switcher Styles
 */

/* Base Styles */
.ft-language-switcher {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.ft-language-switcher * {
    box-sizing: border-box;
}

.ft-flag {
    display: inline-flex;
    align-items: center;
    font-size: 1.2em;
    line-height: 1;
    margin-right: 6px;
}

.ft-lang-name {
    white-space: nowrap;
}

/* Dropdown Style */
.ft-dropdown {
    display: inline-block;
}

.ft-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: inherit;
    transition: all 0.2s;
}

.ft-dropdown-toggle:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.ft-dropdown-arrow {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s;
}

.ft-dropdown.ft-open .ft-dropdown-arrow {
    transform: rotate(180deg);
}

.ft-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 180px;
    margin: 4px 0 0;
    padding: 8px 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    list-style: none;
}

.ft-dropdown.ft-open .ft-dropdown-menu {
    display: block;
}

.ft-dropdown-menu li {
    margin: 0;
    padding: 0;
}

.ft-dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.ft-dropdown-menu a:hover {
    background: #f5f5f5;
}

.ft-dropdown-menu li.ft-active a {
    background: #e8f4fc;
    font-weight: 600;
}

/* List Style */
.ft-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ft-list li {
    margin: 0;
    padding: 0;
}

.ft-list a {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s;
}

.ft-list a:hover {
    background: #f5f5f5;
}

.ft-list li.ft-active a {
    background: #e8f4fc;
    font-weight: 600;
}

/* Inline Style */
.ft-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.ft-inline .ft-lang-link {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.ft-inline .ft-lang-link:hover {
    background: #f5f5f5;
}

.ft-inline .ft-lang-link.ft-active {
    background: #e8f4fc;
    font-weight: 600;
}

.ft-separator {
    color: #ccc;
    margin: 0 4px;
}

/* Popup Style */
.ft-popup {
    display: inline-block;
}

.ft-popup-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: inherit;
    transition: all 0.2s;
}

.ft-popup-toggle:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.ft-globe-icon {
    font-size: 1.2em;
}

.ft-popup-content {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: none;
    min-width: 220px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    overflow: hidden;
}

.ft-popup.ft-open .ft-popup-content {
    display: block;
}

.ft-popup-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 13px;
    color: #666;
}

.ft-popup-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 300px;
    overflow-y: auto;
}

.ft-popup-list li {
    margin: 0;
    padding: 0;
}

.ft-popup-list a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.ft-popup-list a:hover {
    background: #f5f5f5;
}

.ft-popup-list li.ft-active a {
    background: #e8f4fc;
}

.ft-popup-list .ft-check {
    margin-left: auto;
    color: #28a745;
    font-weight: bold;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .ft-dropdown-toggle,
    .ft-popup-toggle {
        background: #2d2d2d;
        border-color: #444;
        color: #eee;
    }
    
    .ft-dropdown-toggle:hover,
    .ft-popup-toggle:hover {
        background: #3d3d3d;
        border-color: #555;
    }
    
    .ft-dropdown-menu,
    .ft-popup-content {
        background: #2d2d2d;
        border-color: #444;
    }
    
    .ft-dropdown-menu a,
    .ft-list a,
    .ft-inline .ft-lang-link,
    .ft-popup-list a {
        color: #eee;
    }
    
    .ft-dropdown-menu a:hover,
    .ft-list a:hover,
    .ft-inline .ft-lang-link:hover,
    .ft-popup-list a:hover {
        background: #3d3d3d;
    }
    
    .ft-dropdown-menu li.ft-active a,
    .ft-list li.ft-active a,
    .ft-inline .ft-lang-link.ft-active,
    .ft-popup-list li.ft-active a {
        background: #1a365d;
    }
    
    .ft-popup-header {
        background: #1d1d1d;
        border-color: #444;
        color: #aaa;
    }
}

/* RTL Support */
[dir="rtl"] .ft-flag,
.ft-rtl .ft-flag {
    margin-right: 0;
    margin-left: 6px;
}

[dir="rtl"] .ft-dropdown-menu,
.ft-rtl .ft-dropdown-menu {
    left: auto;
    right: 0;
}

[dir="rtl"] .ft-popup-list .ft-check,
.ft-rtl .ft-popup-list .ft-check {
    margin-left: 0;
    margin-right: auto;
}

/* Widget Styles */
.widget .ft-language-switcher {
    margin: 0;
}

.widget .ft-dropdown-menu {
    position: relative;
    display: block;
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 0;
}

.widget .ft-dropdown-toggle {
    display: none;
}

/* Menu Integration */
.menu-item.ft-menu-switcher {
    position: relative;
}

.menu-item.ft-menu-switcher .ft-dropdown-toggle {
    background: transparent;
    border: none;
    padding: 0;
}

.menu-item.ft-menu-switcher .ft-dropdown-menu {
    min-width: 200px;
}

/* Animations */
@keyframes ft-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ft-dropdown.ft-open .ft-dropdown-menu,
.ft-popup.ft-open .ft-popup-content {
    animation: ft-fadeIn 0.2s ease-out;
}

/* Accessibility */
.ft-dropdown-toggle:focus,
.ft-popup-toggle:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.ft-dropdown-menu a:focus,
.ft-list a:focus,
.ft-inline .ft-lang-link:focus,
.ft-popup-list a:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

/* Print Styles */
@media print {
    .ft-language-switcher {
        display: none;
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .ft-popup-content {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 16px 16px 0 0;
        max-height: 60vh;
    }
    
    .ft-popup-list {
        max-height: calc(60vh - 60px);
    }
    
    .ft-popup-header {
        padding: 16px;
        font-size: 16px;
    }
    
    .ft-popup-list a {
        padding: 14px 16px;
        font-size: 16px;
    }
}
