/**
 * SanaDigest Weglot Language Selector Styles
 * Custom styling for Weglot language/country dropdown
 *
 * @version 1.0.0
 */

/* ============================================================================
   WEGLOT CONTAINER
   ============================================================================ */

/* Main Weglot container */
.weglot-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Hide Weglot in certain places if needed */
.footer-bottom .weglot-container {
    display: none;
}

/* ============================================================================
   LANGUAGE SWITCHER - DROPDOWN STYLE
   ============================================================================ */

/* Switcher wrapper */
.weglot_switcher {
    position: relative;
    font-family: var(--font-body);
}

/* Current language button */
.weglot_switcher .wgcurrent {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-topbar-text);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.weglot_switcher .wgcurrent:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* When in header (main navigation) */
.site-header .weglot_switcher .wgcurrent {
    color: var(--color-primary);
    border-color: var(--color-border);
    background: var(--color-bg-white);
}

.site-header .weglot_switcher .wgcurrent:hover {
    border-color: var(--color-accent);
    background: var(--color-bg-light);
}

/* Dropdown arrow */
.weglot_switcher .wgcurrent::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 4px;
    transition: transform var(--transition-fast);
}

.weglot_switcher.weglot-open .wgcurrent::after {
    transform: rotate(180deg);
}

/* ============================================================================
   FLAGS
   ============================================================================ */

/* Flag images */
.weglot_switcher img.wglanguage-flag,
.weglot_switcher .weglot-flags img {
    width: 20px !important;
    height: 14px !important;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Flag only mode */
.weglot_switcher.flag-only .wgcurrent span:not(.weglot-flags) {
    display: none;
}

.weglot_switcher.flag-only .wgcurrent {
    padding: 6px 10px;
}

/* ============================================================================
   DROPDOWN MENU
   ============================================================================ */

/* Dropdown list container */
.weglot_switcher ul {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    margin: 4px 0 0;
    padding: 8px 0;
    list-style: none;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

.weglot_switcher.weglot-open ul,
.weglot_switcher:hover ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown items */
.weglot_switcher ul li {
    margin: 0;
    padding: 0;
}

.weglot_switcher ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: var(--font-size-sm);
    color: var(--color-text-body);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.weglot_switcher ul li a:hover {
    background: var(--color-bg-light);
    color: var(--color-accent);
}

.weglot_switcher ul li a.wg-active,
.weglot_switcher ul li.wg-li.active a {
    background: var(--color-accent-light);
    color: var(--color-accent);
    font-weight: var(--font-weight-medium);
}

/* Language name in dropdown */
.weglot_switcher ul li a span {
    flex: 1;
}

/* ============================================================================
   ALTERNATIVE - INLINE SELECTOR STYLE
   ============================================================================ */

/* For inline list of languages (not dropdown) */
.weglot-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.weglot-inline a {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.weglot-inline a:hover {
    color: var(--color-accent);
    background: var(--color-bg-light);
}

.weglot-inline a.active {
    color: var(--color-accent);
    font-weight: var(--font-weight-medium);
}

/* ============================================================================
   TOP BAR SPECIFIC STYLES
   ============================================================================ */

/* Weglot in top bar */
.top-bar .weglot_switcher .wgcurrent {
    padding: 4px 10px;
    font-size: 11px;
    border-color: rgba(255, 255, 255, 0.25);
}

.top-bar .weglot_switcher ul {
    right: 0;
    left: auto;
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .weglot_switcher .wgcurrent {
        padding: 6px 10px;
    }
    
    .weglot_switcher ul {
        min-width: 130px;
    }
    
    .weglot_switcher ul li a {
        padding: 8px 12px;
        font-size: var(--font-size-xs);
    }
    
    /* Center dropdown on mobile */
    .top-bar .weglot_switcher ul {
        right: 50%;
        transform: translateX(50%) translateY(-8px);
    }
    
    .top-bar .weglot_switcher.weglot-open ul,
    .top-bar .weglot_switcher:hover ul {
        transform: translateX(50%) translateY(0);
    }
}

/* ============================================================================
   WIDGET STYLE (if using as widget)
   ============================================================================ */

.widget_weglot_widget {
    padding: 0;
}

.widget_weglot_widget .weglot_switcher {
    width: 100%;
}

.widget_weglot_widget .weglot_switcher .wgcurrent {
    width: 100%;
    justify-content: space-between;
    background: var(--color-bg-light);
    border-color: var(--color-border);
    color: var(--color-primary);
}

.widget_weglot_widget .weglot_switcher ul {
    position: relative;
    top: auto;
    margin-top: 8px;
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* ============================================================================
   SPECIFIC WEGLOT CLASSES OVERRIDE
   ============================================================================ */

/* Weglot default overrides */
#weglot_here,
.weglot-container,
[class*="weglot"] {
    font-family: var(--font-body);
}

.country-selector {
    position: relative;
}

/* Weglot popup/modal styles if any */
.weglot-modal,
.weglot-popup {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .weglot_switcher,
    .weglot-container,
    [class*="weglot"] {
        display: none !important;
    }
}

/* ============================================================================
   NAVBAR CLEANUP - Hide Weglot from menu, show only dropdown
   ============================================================================ */

/* Hide Weglot language items that appear in the nav menu */
.main-navigation .menu-item-language,
.main-navigation .menu-item[class*="weglot"],
.main-navigation li[class*="lang-item"],
.main-navigation .wpml-ls-item,
.main-navigation .menu-item a[href*="weglot"],
#primary-menu > li:has(> .weglot_switcher),
#primary-menu > li:has(> ul .wg-li),
#primary-menu .wg-li,
.menu .lang-item {
    display: none !important;
}

/* Show Weglot as compact dropdown in header actions */
.header-actions .weglot_switcher,
.top-bar .weglot_switcher {
    display: flex !important;
}

.header-actions .weglot_switcher .wgcurrent {
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    gap: 6px;
}

.header-actions .weglot_switcher .wgcurrent:hover {
    background: #fff;
    border-color: #3CB371;
}

.header-actions .weglot_switcher img.wglanguage-flag {
    width: 18px !important;
    height: 13px !important;
    border-radius: 2px;
}

/* Dropdown positioning */
.header-actions .weglot_switcher ul {
    right: 0;
    left: auto;
    min-width: 140px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

/* Clean dropdown items */
.header-actions .weglot_switcher ul li a {
    padding: 10px 14px;
    font-size: 13px;
}
