/**
 * Weglite Translation Plugin - Frontend Styles
 * Version: 2.1.0
 * Place this file in: /wp-content/plugins/weglite/assets/frontend.css
 */

/* ========================================
   Language Switcher Styles
   ======================================== */

.weglite-switcher {
    position: relative;
    display: inline-block;
}

.weglite-switcher .weglite-current {
    cursor: pointer;
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    position: relative;
}

.weglite-switcher .weglite-current:after {
    content: "▼";
    font-size: 10px;
    margin-left: 5px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.weglite-switcher:hover .weglite-current:after {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.weglite-switcher .sub-menu,
.weglite-switcher .weglite-languages {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999999;
    margin: 0;
    padding: 0;
    list-style: none;
}

.weglite-switcher:hover .sub-menu,
.weglite-switcher:hover .weglite-languages {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.weglite-switcher .sub-menu li,
.weglite-switcher .weglite-languages li {
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #f0f0f0;
}

.weglite-switcher .sub-menu li:last-child,
.weglite-switcher .weglite-languages li:last-child {
    border-bottom: none;
}

.weglite-switcher .sub-menu a,
.weglite-switcher .weglite-languages a {
    display: block;
    padding: 10px 15px;
    color: #333333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1.4;
}

.weglite-switcher .sub-menu a:hover,
.weglite-switcher .weglite-languages a:hover {
    background: #f8f9fa;
    color: #0073aa;
    padding-left: 20px;
}

/* Current Language Highlight */
.weglite-switcher .current-lang a {
    background: #f0f6fc;
    color: #0073aa;
    font-weight: 600;
    position: relative;
}

.weglite-switcher .current-lang a:before {
    content: "✓";
    position: absolute;
    left: 5px;
    color: #0073aa;
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */

@media (max-width: 768px) {
    .weglite-switcher .sub-menu,
    .weglite-switcher .weglite-languages {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
    
    .weglite-switcher:hover .sub-menu,
    .weglite-switcher:hover .weglite-languages {
        transform: translateY(0);
    }
    
    .weglite-switcher .sub-menu a,
    .weglite-switcher .weglite-languages a {
        padding: 15px 20px;
        font-size: 16px;
    }
}

/* ========================================
   Theme Compatibility
   ======================================== */

/* Twenty Twenty-One */
.primary-navigation .weglite-switcher .sub-menu {
    background: var(--global--color-background);
    border-color: var(--global--color-border);
}

/* Twenty Twenty */
.header-navigation-wrapper .weglite-switcher .sub-menu {
    background: var(--color-bg);
    border-color: var(--color-border);
}

/* Astra Theme */
.ast-header .weglite-switcher .sub-menu {
    background: var(--ast-global-color-5);
    border-color: var(--ast-border-color);
}

/* GeneratePress */
.main-navigation .weglite-switcher .sub-menu {
    background: var(--base-3);
    border-color: var(--contrast-3);
}

/* ========================================
   Flag Icons (Using Unicode Emojis)
   ======================================== */

.weglite-flag {
    display: inline-block;
    width: 24px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    font-size: 18px;
    line-height: 1;
}

.weglite-flag-en:before { content: "🇬🇧"; }
.weglite-flag-us:before { content: "🇺🇸"; }
.weglite-flag-es:before { content: "🇪🇸"; }
.weglite-flag-fr:before { content: "🇫🇷"; }
.weglite-flag-de:before { content: "🇩🇪"; }
.weglite-flag-it:before { content: "🇮🇹"; }
.weglite-flag-pt:before { content: "🇵🇹"; }
.weglite-flag-nl:before { content: "🇳🇱"; }
.weglite-flag-pl:before { content: "🇵🇱"; }
.weglite-flag-ru:before { content: "🇷🇺"; }
.weglite-flag-zh:before { content: "🇨🇳"; }
.weglite-flag-ja:before { content: "🇯🇵"; }
.weglite-flag-ko:before { content: "🇰🇷"; }
.weglite-flag-ar:before { content: "🇸🇦"; }
.weglite-flag-tr:before { content: "🇹🇷"; }
.weglite-flag-sv:before { content: "🇸🇪"; }
.weglite-flag-no:before { content: "🇳🇴"; }
.weglite-flag-da:before { content: "🇩🇰"; }
.weglite-flag-fi:before { content: "🇫🇮"; }

/* ========================================
   Dark Mode Support
   ======================================== */

@media (prefers-color-scheme: dark) {
    .weglite-switcher .sub-menu,
    .weglite-switcher .weglite-languages {
        background: #2c2c2c;
        border-color: #444444;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .weglite-switcher .sub-menu a,
    .weglite-switcher .weglite-languages a {
        color: #e0e0e0;
    }
    
    .weglite-switcher .sub-menu a:hover,
    .weglite-switcher .weglite-languages a:hover {
        background: #3a3a3a;
        color: #4db8ff;
    }
    
    .weglite-switcher .current-lang a {
        background: #3a3a3a;
        color: #4db8ff;
    }
    
    .weglite-switcher .sub-menu li,
    .weglite-switcher .weglite-languages li {
        border-bottom-color: #3a3a3a;
    }
}

/* ========================================
   Loading States
   ======================================== */

.weglite-translating {
    position: relative;
    opacity: 0.6;
}

.weglite-translating:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top-color: transparent;
    border-radius: 50%;
    animation: weglite-spin 0.8s linear infinite;
}

@keyframes weglite-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Accessibility
   ======================================== */

.weglite-switcher .weglite-current:focus,
.weglite-switcher .sub-menu a:focus,
.weglite-switcher .weglite-languages a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Screen reader only text */
.weglite-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;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .weglite-switcher {
        display: none !important;
    }
}

/**
 * Weglite Translation Plugin - Enhanced Frontend Styles
 */

/* ========================================
   General Switcher Container
   ======================================== */

.weglite-switcher-container {
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========================================
   Select/Dropdown Switcher
   ======================================== */

.weglite-select-switcher {
    padding: 10px 15px;
    padding-right: 35px;
    border: 1px solid #dcdcde;
    border-radius: 5px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23333" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.weglite-select-switcher:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.weglite-select-switcher:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========================================
   Button Switcher
   ======================================== */

.weglite-button-switcher {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    background: #f0f0f1;
    border-radius: 8px;
}

.weglite-lang-button {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    text-decoration: none !important;
    color: #50575e;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
}

.weglite-lang-button:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.weglite-lang-button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* ========================================
   List Switcher
   ======================================== */

.weglite-list-switcher {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.weglite-list-switcher li {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.weglite-list-switcher li:before {
    content: none !important;
}

.weglite-list-switcher a {
    display: block;
    padding: 6px 12px;
    color: #50575e;
    text-decoration: none !important;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.weglite-list-switcher a:hover {
    background: #f0f0f1;
    color: #667eea;
    border-color: #667eea;
}

.weglite-list-switcher .current-lang a {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* ========================================
   Flag Switcher
   ======================================== */

.weglite-flag-switcher {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.weglite-flag-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    text-decoration: none !important;
    color: #50575e;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.weglite-flag-link:hover {
    background: #f0f0f1;
    border-color: #dcdcde;
    transform: translateY(-2px);
}

.weglite-flag-link.active {
    background: #f0f6fc;
    border-color: #667eea;
    color: #667eea;
    font-weight: 600;
}

.weglite-flag {
    display: inline-block;
    width: 24px;
    height: 18px;
    font-size: 18px;
    line-height: 1;
    vertical-align: middle;
}

.weglite-flag-text {
    font-size: 14px;
    font-weight: 500;
}

/* Flag emojis */
.weglite-flag-en:before { content: "🇬🇧"; }
.weglite-flag-us:before { content: "🇺🇸"; }
.weglite-flag-es:before { content: "🇪🇸"; }
.weglite-flag-fr:before { content: "🇫🇷"; }
.weglite-flag-de:before { content: "🇩🇪"; }
.weglite-flag-it:before { content: "🇮🇹"; }
.weglite-flag-pt:before { content: "🇵🇹"; }
.weglite-flag-nl:before { content: "🇳🇱"; }
.weglite-flag-pl:before { content: "🇵🇱"; }
.weglite-flag-ru:before { content: "🇷🇺"; }
.weglite-flag-zh:before { content: "🇨🇳"; }
.weglite-flag-ja:before { content: "🇯🇵"; }
.weglite-flag-ko:before { content: "🇰🇷"; }
.weglite-flag-ar:before { content: "🇸🇦"; }
.weglite-flag-tr:before { content: "🇹🇷"; }
.weglite-flag-sv:before { content: "🇸🇪"; }
.weglite-flag-no:before { content: "🇳🇴"; }
.weglite-flag-da:before { content: "🇩🇰"; }
.weglite-flag-fi:before { content: "🇫🇮"; }
.weglite-flag-hi:before { content: "🇮🇳"; }
.weglite-flag-cs:before { content: "🇨🇿"; }
.weglite-flag-hu:before { content: "🇭🇺"; }
.weglite-flag-ro:before { content: "🇷🇴"; }

/* ========================================
   Floating Button (Styles in PHP)
   ======================================== */

/* Additional floating button styles */
.weglite-floating-button {
    position: fixed;
    z-index: 9999;
}

.weglite-float-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
}

/* ========================================
   Widget Styles
   ======================================== */

.weglite-widget-switcher {
    margin: 20px 0;
}

.widget .weglite-switcher-container {
    width: 100%;
}

.widget .weglite-select-switcher {
    width: 100%;
}

.widget .weglite-button-switcher {
    flex-direction: column;
    width: 100%;
}

.widget .weglite-lang-button {
    width: 100%;
    text-align: center;
}

.widget .weglite-list-switcher {
    flex-direction: column;
}

.widget .weglite-list-switcher a {
    display: block;
    width: 100%;
}

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

@media (max-width: 768px) {
    /* Mobile optimizations */
    .weglite-button-switcher {
        flex-direction: column;
        width: 100%;
    }
    
    .weglite-lang-button {
        width: 100%;
        text-align: center;
    }
    
    .weglite-flag-switcher {
        justify-content: center;
    }
    
    .weglite-list-switcher {
        flex-direction: column;
    }
    
    .weglite-list-switcher a {
        display: block;
        text-align: center;
    }
}

/* ========================================
   Theme Compatibility Overrides
   ======================================== */

/* Ensure our styles take precedence */
.weglite-switcher-container * {
    box-sizing: border-box;
}

/* Fix for themes that add margins to lists */
.weglite-list-switcher,
.weglite-list-switcher li {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-left: 0 !important;
}

/* Fix for themes that style all links */
.weglite-flag-link,
.weglite-lang-button,
.weglite-list-switcher a {
    box-shadow: none !important;
    text-shadow: none !important;
    border-bottom: none !important;
}

/* ========================================
   Dark Mode Support
   ======================================== */

@media (prefers-color-scheme: dark) {
    .weglite-select-switcher {
        background: #2c2c2c;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .weglite-button-switcher {
        background: #2c2c2c;
    }
    
    .weglite-lang-button {
        color: #e0e0e0;
    }
    
    .weglite-lang-button:hover {
        background: #3a3a3a;
        color: #4db8ff;
    }
    
    .weglite-lang-button.active {
        background: #3a3a3a;
        color: #4db8ff;
    }
    
    .weglite-list-switcher a {
        color: #e0e0e0;
    }
    
    .weglite-flag-link {
        color: #e0e0e0;
    }
    
    .weglite-flag-link:hover {
        background: #3a3a3a;
        border-color: #555;
    }
}

/* ========================================
   Animation Effects
   ======================================== */

@keyframes weglite-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.weglite-switcher-container {
    animation: weglite-fade-in 0.3s ease;
}

/* ========================================
   Accessibility
   ======================================== */

.weglite-select-switcher:focus-visible,
.weglite-lang-button:focus-visible,
.weglite-list-switcher a:focus-visible,
.weglite-flag-link:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Screen reader text */
.weglite-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;
}