/* CSS-Only Components - Zero JavaScript */

/* ========================================
   MOBILE MENU - CSS-Only Toggle
   ======================================== */

/* Hide the checkbox */
.mobile-menu-toggle {
    display: none;
}

/* Mobile nav starts hidden off-screen */
#mobile-nav {
    position: fixed;
    top: 0;
    right: -240px;
    width: 240px;
    height: 100%;
    background: #fff;
    transition: right 0.3s ease;
    z-index: 9999;
    display: none;
}

/* Show mobile nav when checkbox is checked */
.mobile-menu-toggle:checked ~ header + #mobile-nav {
    right: 0;
    display: block;
}

/* Alternative selector if nav is sibling to header container */
.mobile-menu-toggle:checked ~ #mobile-nav {
    right: 0;
    display: block;
}

/* Overlay behind menu */
.mobile-menu-toggle:checked::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

/* Menu button and close button styling */
#mob-nav-btn,
#close-mob-nav {
    cursor: pointer;
    display: inline-block;
}

#close-mob-nav {
    padding: 15px;
    display: block;
}

/* ========================================
   LANGUAGE SWITCHER - CSS-Only Hover
   ======================================== */

/* Hide language dropdown by default */
.languages .list-container {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    min-width: 120px;
    z-index: 1000;
}

/* Show dropdown on hover and focus */
.languages:hover .list-container,
.languages:focus-within .list-container {
    display: block;
}

/* Ensure parent is positioned */
.languages {
    position: relative;
}

/* Style the current language selector */
.languages .current {
    cursor: pointer;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.languages .current:hover {
    background-color: #f5f5f5;
}

/* ========================================
   FAQ ACCORDIONS - CSS-Only Details/Summary
   ======================================== */

/* Style the details element */
details {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(30, 58, 95, 0.05);
}

/* Style the summary (question) */
details summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    background-color: #f7fafc;
    color: #1e3a5f;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    user-select: none;
}

/* Remove default marker */
details summary::-webkit-details-marker {
    display: none;
}

/* Add custom arrow indicator */
details summary::after {
    content: '\25BC';
    font-size: 12px;
    color: #4a5568;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

/* Rotate arrow when open */
details[open] summary::after {
    transform: rotate(-180deg);
}

/* Hover effect on summary */
details summary:hover {
    background-color: #edf2f7;
}

/* Style the answer content */
details > div {
    padding: 16px 20px;
    background-color: #fff;
}

/* Open state styling */
details[open] summary {
    background-color: #1e3a5f;
    color: #fff;
    border-bottom: 2px solid #2a5a89;
}

details[open] summary::after {
    color: #fff;
}

/* FAQ wrapper styling */
.schema-faq-code {
    margin-top: 20px;
}

.schema-faq-code details {
    margin-bottom: 8px;
}

/* Nested Schema.org divs */
.schema-faq-code details > div[itemscope] {
    padding: 0;
}

.schema-faq-code details > div[itemscope] > div[itemprop="text"] {
    padding: 16px 20px;
}

/* Typography for FAQ content */
.schema-faq-code details p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.schema-faq-code details p:last-child {
    margin-bottom: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    details summary {
        padding: 14px 16px;
        font-size: 15px;
    }

    details > div,
    .schema-faq-code details > div[itemscope] > div[itemprop="text"] {
        padding: 14px 16px;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Use CSS containment for better performance */
details {
    contain: layout style;
}

/* Optimize animations */
@media (prefers-reduced-motion: reduce) {
    details summary::after,
    .languages .list-container,
    #mobile-nav {
        transition: none;
    }
}

/* Force hardware acceleration */
#mobile-nav,
.languages .list-container {
    transform: translateZ(0);
    will-change: auto;
}

/* Mobile menu is now used for language switching on small screens */

/* Mobile optimization for language switcher */
@media (max-width: 768px) {
    .languages {
        margin-left: auto;
    }

    .languages .current .wrapper {
        padding: 12px 16px;
    }

    .languages .current .wrapper img {
        width: 24px;
        height: 16px;
    }
}

/* Fix flag aspect ratio */
.languages img,
.mobile-langs img,
.lang img {
  width: auto !important;
  height: auto !important;
  max-width: 34px;
  max-height: 19px;
}


/* ========================================
   MODERN LANGUAGE SWITCHER - No Flags, UX Best Practices
   ======================================== */

.lang-switcher {
    position: relative;
    min-width: 140px;
}

.lang-switcher__current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #2d3748;
    transition: all 0.2s ease;
    width: 100%;
}

.lang-switcher__current:hover {
    border-color: #1e3a5f;
    background: #f7fafc;
}

.lang-switcher__current:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.lang-switcher__label {
    flex: 1;
    text-align: left;
}

.lang-switcher__icon {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #4a5568;
}

/* Dropdown menu */
.lang-switcher__menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

/* Show menu on hover/focus */
.lang-switcher:hover .lang-switcher__menu,
.lang-switcher:focus-within .lang-switcher__menu,
.lang-switcher__current:focus + .lang-switcher__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Rotate icon when menu is open */
.lang-switcher:hover .lang-switcher__icon,
.lang-switcher:focus-within .lang-switcher__icon {
    transform: rotate(180deg);
}

.lang-switcher__menu li {
    margin: 0;
    padding: 0;
}

.lang-switcher__menu a {
    display: block;
    padding: 10px 16px;
    color: #2d3748;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.15s ease;
}

.lang-switcher__menu a:hover {
    background: #f7fafc;
    color: #1e3a5f;
}

.lang-switcher__menu a.active {
    background: #e6f2ff;
    color: #1e3a5f;
    font-weight: 600;
    position: relative;
}

.lang-switcher__menu a.active::before {
    content: '✓';
    position: absolute;
    left: 16px;
    color: #1e3a5f;
    font-weight: 700;
}

.lang-switcher__menu a.active {
    padding-left: 32px;
}

/* Mobile language switcher */
.mobile-lang-switcher {
    margin-top: 24px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}

.mobile-lang-item {
    margin-bottom: 4px;
}

.mobile-lang-item a {
    display: block;
    padding: 12px 16px;
    color: #2d3748;
    font-size: 16px;
    font-weight: 400;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.mobile-lang-item a:hover {
    background: #f7fafc;
    color: #1e3a5f;
}

.mobile-lang-item.active a {
    background: #e6f2ff;
    color: #1e3a5f;
    font-weight: 600;
}

/* Hide on desktop */
@media (min-width: 701px) {
    #mobile-nav,
    #mob-nav-btn {
        display: none;
    }
}

/* Hide lang switcher on mobile */
@media (max-width: 700px) {
    .lang-switcher {
        display: none !important;
    }

    .lang-switcher__menu {
        display: none !important;
    }

    .lang-switcher__current {
        display: none !important;
    }
}

/* Fix phone number and language switcher spacing */
header .nav-item.phone-numbers-container {
    margin-right: 16px;
    flex-shrink: 0;
}

.lang-switcher {
    flex-shrink: 0;
    margin-left: 0;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    header .nav-item.phone-numbers-container {
        margin-right: 8px;
    }
    
    .lang-switcher {
        min-width: 120px;
    }
    
    .lang-switcher__current {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    header .nav-item.phone-numbers-container .phone-number {
        font-size: 14px;
    }
}

/* Ensure language switcher is above blog navigation and other elements */
.lang-switcher {
    z-index: 2000;
}

.lang-switcher__menu {
    z-index: 2001;
}

/* Fix header container overflow to allow dropdown to show */
header .container {
    overflow: visible !important;
}

/* Increase z-index even more to be above everything */
.lang-switcher {
    z-index: 10001 !important;
}

.lang-switcher__menu {
    z-index: 10002 !important;
}
