/**
 * STI-2026 Language Switcher Styles
 * Modern, responsive flag buttons for menu integration
 */

/* Language switcher container */
.sti-language-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Menu integration */
.sti-lang-switcher-menu {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sti-lang-switcher-menu .sti-language-switcher {
    margin: 0;
    padding: 0;
}

/* Flag button base styles */
.sti-lang-flag {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    background: none;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 52px;
    text-decoration: none;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    outline: none;
    position: relative;
}

/* Flag emoji */
.sti-lang-flag .flag {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    display: block;
}

/* Language code text */
.sti-lang-flag .lang-code {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    color: #666;
    text-shadow: none;
    display: block;
}

/* Hover states */
.sti-lang-flag:hover {
    border-color: #ff6600;
    background-color: #fff5f1;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 102, 0, 0.15);
}

.sti-lang-flag:hover .flag {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.sti-lang-flag:hover .lang-code {
    color: #ff6600;
}

/* Focus states */
.sti-lang-flag:focus {
    border-color: #ff6600;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.2);
}

/* Active state */
.sti-lang-flag.active {
    border-color: #ff6600;
    background: linear-gradient(135deg, #ff6600 0%, #ff8533 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.4);
    transform: translateY(-1px);
}

.sti-lang-flag.active .flag {
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.sti-lang-flag.active .lang-code {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.sti-lang-flag.active:hover {
    background: linear-gradient(135deg, #ff7711 0%, #ff9944 100%);
    transform: translateY(-1px);
}

/* Pressed state */
.sti-lang-flag:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Menu positioning - align flags to the right */
.nav-menu {
    position: relative;
}

.nav-menu .sti-lang-switcher-menu {
    margin-left: auto !important;
    order: 999;
}

/* Navigation menu specific adjustments */
.nav-menu .sti-lang-flag {
    padding: 8px 10px;
    margin: 0 2px;
    min-width: 56px;
}

.nav-menu .sti-lang-flag .flag {
    font-size: 22px;
    margin-bottom: 3px;
}

.nav-menu .sti-lang-flag .lang-code {
    font-size: 11px;
}

/* Shortcode style (for manual placement) */
.sti-language-switcher.shortcode-style {
    display: inline-flex;
    margin: 10px 0;
}

.shortcode-style .sti-lang-flag {
    margin: 0 4px;
}

/* STI-2026 theme integration */
.header .nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header .nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header .nav-menu li {
    margin: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .sti-language-switcher {
        gap: 6px;
    }

    .sti-lang-flag {
        padding: 6px 8px;
        min-width: 48px;
    }

    .sti-lang-flag .flag {
        font-size: 18px;
    }

    .sti-lang-flag .lang-code {
        font-size: 9px;
    }

    /* Mobile menu adjustments */
    .nav-menu.mobile-open .sti-lang-switcher-menu {
        order: 1;
        margin: 15px auto 0 auto !important;
        text-align: center;
    }

    .nav-menu.mobile-open .sti-language-switcher {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sti-lang-flag {
        padding: 5px 6px;
        min-width: 44px;
    }

    .sti-lang-flag .flag {
        font-size: 16px;
    }

    .sti-lang-flag .lang-code {
        font-size: 8px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .sti-lang-flag {
        background-color: #2a2a2a;
        border-color: #444;
    }

    .sti-lang-flag:hover {
        background-color: #3a2f2a;
    }

    .sti-lang-flag .lang-code {
        color: #ccc;
    }

    .sti-lang-flag:hover .lang-code {
        color: #ff6600;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .sti-lang-flag {
        border-width: 3px;
        box-shadow: none;
    }

    .sti-lang-flag:focus {
        box-shadow: 0 0 0 4px rgba(255, 102, 0, 0.5);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .sti-lang-flag {
        transition: none;
    }

    .sti-lang-flag:hover {
        transform: none;
    }

    .sti-lang-flag.active {
        transform: none;
    }
}

/* Print styles */
@media print {
    .sti-language-switcher {
        display: none;
    }
}

/* Animation for flag loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sti-lang-flag {
    animation: fadeInUp 0.3s ease-out;
}

/* Loading state */
.sti-lang-flag.loading {
    opacity: 0.6;
    pointer-events: none;
}

.sti-lang-flag.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid #ff6600;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Accessibility improvements */
.sti-lang-flag:focus-visible {
    outline: 3px solid #ff6600;
    outline-offset: 2px;
}

/* Screen reader text */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}