/**
 * PDR Language Switcher Styles
 * Multiple visual styles inspired by WPML
 */

/* Base styles for all switchers */
.pdr-language-switcher {
    display: inline-block;
    font-family: inherit;
    position: relative;
}

.pdr-language-switcher * {
    box-sizing: border-box;
}

/* Flag styles */
.pdr-flag {
    width: 16px;
    height: 11px;
    margin-right: 5px;
    vertical-align: middle;
    border: 1px solid #ddd;
    border-radius: 1px;
}

/* Language name styles */
.pdr-lang-name {
    vertical-align: middle;
}

/* ===== DROPDOWN STYLE ===== */
.pdr-dropdown-style {
    position: relative;
    z-index: 1000;
}

.pdr-dropdown-trigger {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    min-width: 120px;
    position: relative;
    transition: all 0.2s ease;
}

.pdr-dropdown-trigger:hover {
    border-color: #007cba;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.1);
}

.pdr-dropdown-arrow {
    margin-left: auto;
    font-size: 10px;
    color: #666;
    transition: transform 0.2s ease;
}

.pdr-dropdown-style.active .pdr-dropdown-arrow {
    transform: rotate(180deg);
}

.pdr-dropdown-title {
    color: #666;
    font-size: 14px;
}

.pdr-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.pdr-dropdown-style.active .pdr-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pdr-dropdown-menu .pdr-lang-item {
    border-bottom: 1px solid #f0f0f0;
}

.pdr-dropdown-menu .pdr-lang-item:last-child {
    border-bottom: none;
}

.pdr-dropdown-menu .pdr-lang-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s ease;
}

.pdr-dropdown-menu .pdr-lang-link:hover {
    background-color: #f8f9fa;
    color: #007cba;
}

.pdr-dropdown-menu .pdr-lang-item.current .pdr-lang-link {
    background-color: #e7f3ff;
    color: #007cba;
    font-weight: 500;
}

/* ===== LIST STYLE ===== */
.pdr-list-style .pdr-lang-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pdr-list-style .pdr-lang-item {
    margin: 0;
}

.pdr-list-style .pdr-lang-link {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    text-decoration: none;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.pdr-list-style .pdr-lang-link:hover {
    border-color: #007cba;
    color: #007cba;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.1);
}

.pdr-list-style .pdr-lang-item.current .pdr-lang-link {
    background-color: #007cba;
    border-color: #007cba;
    color: #fff;
}

/* ===== FLAGS STYLE ===== */
.pdr-flags-style .pdr-flags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.pdr-flags-style .pdr-flag-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    position: relative;
}

.pdr-flags-style .pdr-flag-link:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
}

.pdr-flags-style .pdr-flag-link.current {
    background-color: #e7f3ff;
    box-shadow: 0 0 0 2px #007cba;
}

.pdr-flags-style .pdr-flag-link .pdr-flag {
    margin-right: 0;
    width: 20px;
    height: 14px;
}

.pdr-flags-style .pdr-lang-name {
    font-size: 12px;
    margin-left: 4px;
    white-space: nowrap;
}

/* ===== BUTTONS STYLE ===== */
.pdr-buttons-style .pdr-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pdr-buttons-style .pdr-lang-button {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    text-decoration: none;
    color: #333;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 20px;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
}

.pdr-buttons-style .pdr-lang-button:hover {
    background: #e9ecef;
    border-color: #007cba;
    color: #007cba;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.pdr-buttons-style .pdr-lang-button.current {
    background: #007cba;
    border-color: #007cba;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.3);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .pdr-dropdown-trigger {
        min-width: 100px;
        padding: 6px 10px;
    }
    
    .pdr-list-style .pdr-lang-list {
        gap: 4px;
    }
    
    .pdr-list-style .pdr-lang-link {
        padding: 4px 8px;
        font-size: 13px;
    }
    
    .pdr-buttons-style .pdr-lang-button {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .pdr-flags-style .pdr-flag-link .pdr-lang-name {
        display: none; /* Hide names on mobile for flags style */
    }
}

/* ===== MENU INTEGRATION ===== */
.menu-item-language-switcher {
    position: relative;
}

.menu-language-switcher {
    margin: 0;
}

.menu-language-switcher .pdr-lang-list {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    flex-direction: column;
    gap: 0;
    min-width: 120px;
}

.menu-item-language-switcher:hover .menu-language-switcher .pdr-lang-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-language-switcher .pdr-lang-item {
    border-bottom: 1px solid #f0f0f0;
}

.menu-language-switcher .pdr-lang-item:last-child {
    border-bottom: none;
}

.menu-language-switcher .pdr-lang-link {
    border: none;
    border-radius: 0;
    justify-content: flex-start;
    padding: 8px 12px;
}

/* ===== WIDGET STYLES ===== */
.widget.widget_pdr_language_switcher {
    margin-bottom: 20px;
}

.widget.widget_pdr_language_switcher .widget-title {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

/* ===== LOADING STATE ===== */
.pdr-language-switcher.loading {
    pointer-events: none;
    opacity: 0.7;
}

.pdr-language-switcher.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: pdr-spin 1s linear infinite;
    z-index: 1002;
}

@keyframes pdr-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ACCESSIBILITY ===== */
.pdr-language-switcher:focus-within,
.pdr-language-switcher .pdr-lang-link:focus,
.pdr-dropdown-trigger:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .pdr-dropdown-trigger {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .pdr-dropdown-menu {
        background: #2c3e50;
        border-color: #34495e;
    }
    
    .pdr-dropdown-menu .pdr-lang-link {
        color: #ecf0f1;
    }
    
    .pdr-dropdown-menu .pdr-lang-link:hover {
        background-color: #34495e;
    }
    
    .pdr-list-style .pdr-lang-link {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .pdr-buttons-style .pdr-lang-button {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
}
