/* Custom TranslatePress Menu Selector - Frontend Styles */

.ctms-language-selector {
    position: relative;
    display: inline-block;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

/* Dropdown Style */
.ctms-dropdown {
    position: relative;
    display: inline-block;
}

.ctms-dropdown-toggle {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.ctms-dropdown-toggle:hover {
    background: #f8f9fa;
    color: inherit;
    text-decoration: none;
}

.ctms-arrow {
    margin-left: 6px;
    font-size: 10px;
    transition: transform 0.3s ease;
}

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

.ctms-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.ctms-dropdown.ctms-open .ctms-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ctms-dropdown-menu .ctms-language-link {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.ctms-dropdown-menu .ctms-language-link:last-child {
    border-bottom: none;
}

.ctms-dropdown-menu .ctms-language-link:hover {
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
}

/* Horizontal Style - All Flags in One Row */
.ctms-horizontal {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ctms-language-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    font-size: inherit;
    line-height: 1;
}

.ctms-horizontal .ctms-current {
    background: rgba(0, 123, 255, 0.1);
    border: 1px solid rgba(0, 123, 255, 0.3);
    font-weight: 600;
    color: #0056b3;
}

.ctms-horizontal .ctms-language-link {
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.1);
}

.ctms-horizontal .ctms-language-link:hover {
    background: rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.2);
    text-decoration: none;
    color: inherit;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Make flags consistent size in horizontal layout */
.ctms-horizontal .ctms-flag {
    width: 32px;
    height: 24px;
    margin-right: 8px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Text styling for horizontal layout */
.ctms-horizontal .ctms-name {
    font-size: 13px;
    white-space: nowrap;
}

/* Flag and Name Styling - Larger flat flags */
.ctms-flag {
    width: 32px;
    height: 24px;
    margin-right: 8px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.ctms-name {
    font-size: inherit;
    line-height: inherit;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ctms-responsive.ctms-language-selector {
        font-size: 13px;
    }
    
    .ctms-responsive .ctms-dropdown-toggle {
        padding: 6px 10px;
    }
    
    .ctms-responsive .ctms-dropdown-menu .ctms-language-link {
        padding: 8px 10px;
    }
    
    .ctms-responsive .ctms-flag {
        width: 28px;
        height: 21px;
        margin-right: 6px;
    }
    
    .ctms-responsive .ctms-horizontal {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .ctms-responsive .ctms-horizontal .ctms-current,
    .ctms-responsive .ctms-horizontal .ctms-language-link {
        padding: 4px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .ctms-responsive.ctms-style-horizontal .ctms-horizontal {
        gap: 2px;
    }
    
    .ctms-responsive.ctms-style-horizontal .ctms-language-item {
        padding: 2px 4px;
        font-size: 11px;
    }
    
    .ctms-responsive.ctms-style-horizontal .ctms-flag {
        width: 24px;
        height: 18px;
        margin-right: 5px;
    }
    
    .ctms-responsive.ctms-style-horizontal .ctms-name {
        display: none;
    }
    
    /* Keep dropdown style compact on mobile */
    .ctms-responsive.ctms-style-dropdown .ctms-name {
        display: none;
    }
    
    .ctms-responsive.ctms-style-dropdown .ctms-flag {
        width: 24px;
        height: 18px;
        margin-right: 0;
    }
}

/* Integration with common WordPress themes */

/* Menu Integration Styles */
.menu-item-language-selector {
    position: relative;
}

.menu-item-language-selector .ctms-language-selector {
    margin: 0;
    display: block;
    width: 100%;
}

/* Reset dropdown styling for menu context */
.menu-item-language-selector .ctms-dropdown {
    display: block;
    width: 100%;
}

.menu-item-language-selector .ctms-dropdown-toggle {
    color: inherit;
    background: transparent;
    border: none;
    padding: 10px 15px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
}

.menu-item-language-selector .ctms-dropdown-toggle:hover,
.menu-item-language-selector .ctms-dropdown-toggle:focus {
    background: rgba(0,0,0,0.05);
    color: inherit;
    text-decoration: none;
}

/* Menu dropdown positioning */
.menu-item-language-selector .ctms-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    margin-top: 0;
    z-index: 999999;
}

/* Horizontal style in menus */
.menu-item-language-selector .ctms-horizontal {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-start;
}

.menu-item-language-selector .ctms-language-item {
    padding: 5px 8px;
    margin: 0;
    border-radius: 4px;
    font-size: 12px;
}

.menu-item-language-selector .ctms-horizontal .ctms-current {
    background: rgba(0, 123, 255, 0.15);
    border: 1px solid rgba(0, 123, 255, 0.4);
    font-weight: 700;
    color: #004085;
}

.menu-item-language-selector .ctms-horizontal .ctms-language-link {
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.15);
}

.menu-item-language-selector .ctms-horizontal .ctms-language-link:hover {
    background: rgba(0,0,0,0.1);
    border-color: rgba(0,0,0,0.25);
    text-decoration: none;
}

/* Menu flag sizing */
.menu-item-language-selector .ctms-flag {
    width: 24px;
    height: 18px;
    margin-right: 6px;
}

/* Mobile menu specific styles */
.mobile-menu .menu-item-language-selector .ctms-dropdown-menu,
.mobile-nav .menu-item-language-selector .ctms-dropdown-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    border: none;
    background: rgba(0,0,0,0.05);
    margin-top: 0;
}

/* Theme compatibility */
.nav-menu .menu-item-language-selector,
.primary-menu .menu-item-language-selector {
    display: list-item;
}

/* Ensure proper spacing in vertical menus */
.menu-item-language-selector .ctms-flag {
    width: 18px;
    height: auto;
    margin-right: 6px;
    vertical-align: middle;
}

/* For Twenty Twenty themes */
.primary-menu .menu-item .ctms-language-selector {
    display: inline-block;
}

/* For mobile menu toggles */
.mobile-menu .ctms-language-selector,
.mobile-nav .ctms-language-selector {
    width: 100%;
}

.mobile-menu .ctms-dropdown,
.mobile-nav .ctms-dropdown {
    width: 100%;
}

.mobile-menu .ctms-dropdown-toggle,
.mobile-nav .ctms-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
}

.mobile-menu .ctms-dropdown-menu,
.mobile-nav .ctms-dropdown-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    border: none;
    background: rgba(0,0,0,0.05);
    margin-top: 5px;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .ctms-dropdown-toggle {
        background: #2c2c2c;
        border-color: rgba(255,255,255,0.1);
        color: #fff;
    }
    
    .ctms-dropdown-toggle:hover {
        background: #3c3c3c;
    }
    
    .ctms-dropdown-menu {
        background: #2c2c2c;
        border-color: rgba(255,255,255,0.1);
    }
    
    .ctms-dropdown-menu .ctms-language-link {
        color: #fff;
        border-bottom-color: rgba(255,255,255,0.05);
    }
    
    .ctms-dropdown-menu .ctms-language-link:hover {
        background: #3c3c3c;
        color: #fff;
    }
    
    .ctms-horizontal .ctms-current {
        background: rgba(255,255,255,0.1);
    }
    
    .ctms-horizontal .ctms-language-link:hover {
        background: rgba(255,255,255,0.1);
    }
}

/* Accessibility */
.ctms-language-selector:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.ctms-dropdown-toggle:focus,
.ctms-language-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Animation for better UX */
.ctms-language-link {
    transform: translateY(0);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.ctms-language-link:hover {
    transform: translateY(-1px);
}

/* RTL Support */
.rtl .ctms-flag {
    margin-right: 0;
    margin-left: 6px;
}

.rtl .ctms-arrow {
    margin-left: 0;
    margin-right: 6px;
}

.rtl .ctms-dropdown-menu {
    left: auto;
    right: 0;
} 