/* ==========================================================================
   Alisetechnic Language Switcher
   Professional responsive language switching component
   
   Version: 1.3.0
   ========================================================================== */

/* ==========================================================================
   CSS Custom Properties (Easy theming)
   
   NOTE: The following variables are SET by the Customizer (css-optimizer.php)
   and must NOT be declared here to avoid CSS cascade override:
   --at-lang-bg, --at-lang-text, --at-lang-accent,
   --at-lang-font-size, --at-lang-flag-size, --at-lang-radius
   
   Only non-Customizer variables are declared below as defaults.
   ========================================================================== */
:root {
    --at-lang-bg-hover: rgba(0, 0, 0, 0.04);
    --at-lang-border: transparent;
    --at-lang-text-hover: #000;
    --at-lang-text-secondary: #666;
    --at-lang-shadow: none;
    --at-lang-shadow-hover: none;
    --at-lang-font: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;
    --at-lang-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    /* Glassmorphism dropdown */
    --at-lang-dropdown-bg: rgba(255, 255, 255, 0.85);
    --at-lang-dropdown-border: rgba(255, 255, 255, 0.3);
    --at-lang-dropdown-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   Base Switcher Container
   ========================================================================== */
.at-lang-switcher {
    position: relative;
    display: inline-flex;
    font-family: var(--at-lang-font);
    z-index: 1000;
}

/* ==========================================================================
   Toggle Button
   Override Elementor Kit global button styles:
   .elementor-kit-XXXXX button has specificity 0,1,1 which beats .at-lang-toggle (0,1,0).
   Using button.at-lang-toggle gives 0,1,1 to match, and load order wins.
   ========================================================================== */
button.at-lang-toggle,
.at-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--at-lang-bg);
    background-color: var(--at-lang-bg);
    border: none;
    border-radius: var(--at-lang-radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--at-lang-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--at-lang-transition);
}

.at-lang-toggle:hover,
button.at-lang-toggle:hover {
    background: var(--at-lang-bg-hover);
    background-color: var(--at-lang-bg-hover);
    color: var(--at-lang-text-hover);
}

.at-lang-toggle:hover .at-lang-code {
    color: var(--at-lang-text-hover);
}

.at-lang-toggle:focus {
    outline: none;
    background: var(--at-lang-bg-hover);
}

/* Flag Icon */
.at-lang-flag {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Language Code */
.at-lang-code {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Language Name (optional) */
.at-lang-name {
    font-weight: 500;
}

/* Dropdown Arrow */
.at-lang-arrow {
    width: 10px;
    height: auto;
    opacity: 0.6;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.at-lang-switcher.is-open .at-lang-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   Dropdown Menu (Glassmorphism) - ALWAYS HIDDEN BY DEFAULT
   ========================================================================== */
.at-lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--at-lang-dropdown-bg);
    border: 1px solid var(--at-lang-dropdown-border);
    border-radius: var(--at-lang-radius);
    box-shadow: var(--at-lang-dropdown-shadow);
    padding: 6px;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px);
    transition: var(--at-lang-transition);
    z-index: 1001;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    pointer-events: none !important;
    display: none !important;
}

/* Show dropdown ONLY when parent has is-open class */
.at-lang-switcher.is-open .at-lang-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0);
    pointer-events: auto !important;
    display: block !important;
}

/* Dropdown Items */
.at-lang-dropdown .at-lang-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--at-lang-text);
    transition: var(--at-lang-transition);
}

.at-lang-dropdown .at-lang-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.at-lang-dropdown .at-lang-item:hover .at-lang-name {
    color: var(--at-lang-text-hover);
    font-weight: 600;
}

.at-lang-dropdown .at-lang-item:hover .at-lang-code {
    color: var(--at-lang-text-hover);
}

.at-lang-dropdown .at-lang-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.at-lang-dropdown .at-lang-code {
    font-size: 11px;
    font-weight: 700;
    color: var(--at-lang-text-secondary);
}

/* ==========================================================================
   Inline Style
   ========================================================================== */
.at-lang-switcher--inline {
    gap: 4px;
}

.at-lang-switcher--inline .at-lang-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--at-lang-radius);
    text-decoration: none;
    color: var(--at-lang-text);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    transition: var(--at-lang-transition);
}

.at-lang-switcher--inline .at-lang-item:hover {
    background: var(--at-lang-bg);
    border-color: var(--at-lang-border);
}

.at-lang-switcher--inline .at-lang-item.is-active {
    background: var(--at-lang-bg);
    border-color: var(--at-lang-accent);
    color: var(--at-lang-accent);
}

.at-lang-switcher--inline .at-lang-flag {
    width: 20px;
    height: 14px;
}

/* ==========================================================================
   Minimal Style (simple text links with separator)
   ========================================================================== */
.at-lang-switcher--minimal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.at-lang-switcher--minimal .at-lang-item {
    text-decoration: none;
    color: var(--at-lang-text);
    transition: var(--at-lang-transition);
    padding: 4px 2px;
}

.at-lang-switcher--minimal .at-lang-item:hover {
    color: var(--at-lang-text-hover);
}

.at-lang-switcher--minimal .at-lang-item.is-active {
    color: var(--at-lang-accent);
    font-weight: 700;
}

.at-lang-switcher--minimal .at-lang-separator {
    color: var(--at-lang-text-secondary);
    opacity: 0.5;
    font-weight: 300;
}

/* ==========================================================================
   Globe Style (icon with dropdown)
   ========================================================================== */
.at-lang-switcher--globe {
    position: relative;
}

.at-lang-switcher--globe .at-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--at-lang-radius);
    cursor: pointer;
    color: var(--at-lang-text);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--at-lang-transition);
}

.at-lang-switcher--globe .at-lang-toggle:hover {
    color: var(--at-lang-text-hover);
    background: rgba(0, 0, 0, 0.05);
}

.at-lang-switcher--globe .at-globe-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.at-lang-switcher--globe .at-lang-code {
    font-weight: 600;
}

.at-lang-switcher--globe .at-lang-arrow {
    width: 8px;
    height: 5px;
    transition: transform 0.2s ease;
}

.at-lang-switcher--globe[data-open="true"] .at-lang-arrow {
    transform: rotate(180deg);
}

/* Globe Dropdown */
.at-lang-switcher--globe .at-lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 160px;
    padding: 8px;
    background: var(--at-lang-bg);
    border-radius: 8px;
    box-shadow: var(--at-lang-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 10001;
}

.at-lang-switcher--globe[data-open="true"] .at-lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.at-lang-switcher--globe .at-lang-dropdown .at-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--at-lang-text);
    transition: var(--at-lang-transition);
}

.at-lang-switcher--globe .at-lang-dropdown .at-lang-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.at-lang-switcher--globe .at-lang-dropdown .at-lang-flag {
    width: 20px;
    height: 14px;
}

.at-lang-switcher--globe .at-lang-dropdown .at-lang-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.at-lang-switcher--globe .at-lang-dropdown .at-lang-code {
    font-size: 11px;
    font-weight: 700;
    color: var(--at-lang-text-secondary);
}

/* ==========================================================================
   Header Integration
   ========================================================================== */
.site-header .at-lang-switcher {
    margin-left: 20px;
}

.header-inner .at-lang-switcher {
    flex-shrink: 0;
}

/* ==========================================================================
   Elementor Integration
   ========================================================================== */
.elementor-widget-alisetechnic_language_switcher {
    display: inline-flex;
}

.elementor-widget-alisetechnic_language_switcher .at-lang-switcher {
    width: 100%;
}

/* ==========================================================================
   RESPONSIVE - Large Desktop (1400px+)
   ========================================================================== */
@media (min-width: 1400px) {
    .at-lang-toggle {
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .at-lang-flag {
        width: 22px;
        height: 15px;
    }
}

/* ==========================================================================
   RESPONSIVE - Medium Desktop (1200px - 1399px)
   ========================================================================== */
@media (max-width: 1399px) {
    .at-lang-toggle {
        padding: 9px 12px;
        font-size: 11px;
    }
    
    .at-lang-flag {
        width: 20px;
        height: 14px;
    }
}

/* ==========================================================================
   RESPONSIVE - Small Desktop (992px - 1199px)
   ========================================================================== */
@media (max-width: 1199px) {
    .at-lang-toggle {
        padding: 8px 12px;
        font-size: 10px;
        gap: 6px;
    }
    
    .at-lang-flag {
        width: 20px;
        height: 14px;
    }
    
    .at-lang-arrow {
        width: 8px;
    }
    
    .site-header .at-lang-switcher {
        margin-left: 15px;
    }
}

/* ==========================================================================
   RESPONSIVE - Tablet (768px - 991px)
   ========================================================================== */
@media (max-width: 991px) {
    .at-lang-toggle {
        padding: 8px 10px;
        gap: 5px;
    }
    
    .at-lang-flag {
        width: 18px;
        height: 12px;
    }
    
    .at-lang-name {
        display: none;
    }
    
    .site-header .at-lang-switcher {
        margin-left: 10px;
    }
}

/* ==========================================================================
   RESPONSIVE - Mobile (max 991px)
   ========================================================================== */
@media (max-width: 991px) {
    /* Hide desktop switcher wrapper */
    .desktop-only,
    .at-lang-switcher-wrap.desktop-only {
        display: none !important;
    }
    
    /* Mobile header actions visibility: controlled by header.css (single source of truth) */
    
    /* Mobile language switcher in header */
    .at-lang-switcher-mobile {
        display: block;
    }
    
    .at-lang-mobile-header {
        position: relative;
    }
    
    .at-lang-mobile-header .at-lang-toggle {
        padding: 8px;
        background: transparent;
        border: none;
        gap: 0;
    }
    
    .at-lang-mobile-header .at-lang-toggle:hover {
        background: rgba(0, 0, 0, 0.05);
    }
    
    .at-lang-mobile-header .at-lang-flag {
        width: 24px;
        height: 16px;
        border-radius: 3px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    }
    
    .at-lang-mobile-header .at-lang-arrow {
        display: none;
    }
    
    .at-lang-mobile-header .at-lang-code,
    .at-lang-mobile-header .at-lang-name {
        display: none;
    }
    
    /* Dropdown appears below the flag - HIDDEN by default */
    .at-lang-mobile-header .at-lang-dropdown {
        position: absolute;
        top: calc(100% + 10px);
        right: -10px;
        left: auto;
        min-width: 160px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 10px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        padding: 8px;
        /* Hidden state - FORCE HIDE */
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-10px);
        pointer-events: none !important;
        display: none !important;
    }
    
    /* Show dropdown when open */
    .at-lang-mobile-header.is-open .at-lang-dropdown {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0);
        pointer-events: auto !important;
        display: block !important;
    }
    
    .at-lang-mobile-header .at-lang-dropdown .at-lang-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 6px;
    }
    
    .at-lang-mobile-header .at-lang-dropdown .at-lang-flag {
        width: 22px;
        height: 15px;
    }
    
    .at-lang-mobile-header .at-lang-dropdown .at-lang-name {
        display: block;
        flex: 1;
        font-size: 14px;
        font-weight: 500;
    }
    
    .at-lang-mobile-header .at-lang-dropdown .at-lang-code {
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: var(--at-lang-text-secondary);
    }
}

/* ==========================================================================
   RESPONSIVE - Mobile Small (max 767px)
   ========================================================================== */
@media (max-width: 767px) {
    
    .at-lang-mobile-header .at-lang-toggle {
        padding: 6px;
    }
    
    .at-lang-mobile-header .at-lang-flag {
        width: 22px;
        height: 15px;
    }
    
    /* Inline style on mobile */
    .at-lang-switcher--inline {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .at-lang-switcher--inline .at-lang-item {
        padding: 10px 14px;
    }
}

/* ==========================================================================
   Dark Mode Support (optional)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .at-lang-switcher[data-theme="auto"] {
        --at-lang-bg: rgba(40, 40, 40, 0.95);
        --at-lang-bg-hover: rgba(50, 50, 50, 1);
        --at-lang-border: rgba(255, 255, 255, 0.1);
        --at-lang-text: #ffffff;
        --at-lang-text-secondary: #aaa;
    }
}

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */
@keyframes at-lang-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .at-lang-switcher {
        display: none !important;
    }
}
