/* Custom fixes for specific issues */

/* Language switcher dropdown styling for 11 languages */
.language-switcher {
    position: relative;
    margin-left: 1.25rem;
    font-size: 0.9rem;
}

.language-switcher .lang-current {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--light);
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.language-switcher .lang-current:hover {
    background: rgba(255, 255, 255, 0.1);
}

.language-switcher .lang-current::after {
    content: '';
    border: solid rgba(248, 250, 252, 0.75);
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
    margin-left: 4px;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
}

.language-switcher:hover .lang-current::after,
.language-switcher:focus-within .lang-current::after {
    transform: rotate(-135deg);
    margin-bottom: -2px;
}

.language-switcher .lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.language-switcher:hover .lang-dropdown,
.language-switcher:focus-within .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.language-switcher .lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: rgba(248, 250, 252, 0.75);
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: var(--transition);
}

.language-switcher .lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
}

.language-switcher .lang-option.active {
    color: var(--secondary);
    background: rgba(99, 102, 241, 0.1);
}

.language-switcher .lang-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.language-switcher .lang-current .lang-flag {
    width: 22px;
    height: 16px;
}

.language-switcher .lang-option .lang-flag {
    width: 20px;
    height: 15px;
}

.language-switcher .lang-option .lang-name {
    font-size: 0.85rem;
}

.language-switcher .lang-option:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: -2px;
}

/* Fallback inline style for legacy (keep for backwards compatibility) */
.language-switcher .lang-divider {
    color: rgba(248, 250, 252, 0.55);
    font-size: 0.8rem;
}

/* Mobile adjustments for language dropdown */
@media (max-width: 768px) {
    .language-switcher .lang-dropdown {
        right: -10px;
    }
}

/* Fix blog footer header alignment on mobile */
@media (max-width: 768px) {
    .blog-title, .blog-description {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Make sure contact form is fully responsive */
@media (max-width: 600px) {
    .contact-form-wrapper {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Fix "Back to top" button position - ensure it's always on the right side */
.back-to-top,
a.back-to-top,
.page-wrapper + .back-to-top,
footer + .back-to-top,
body > .back-to-top,
#blog footer + .back-to-top,
.blog footer + .back-to-top,
.blog-grid-section ~ footer + .back-to-top,
.blog .back-to-top,
.blog-post-content-section ~ footer + .back-to-top,
#footer + .back-to-top,
.page-wrapper .back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem !important; 
    left: auto !important;
    z-index: 99;
    width: 3rem;
    height: 3rem;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Active state for Back to top button */
.back-to-top.active {
    opacity: 1;
    transform: translateY(0);
}

/* Hover state */
.back-to-top:hover {
    background-color: var(--secondary);
}

/* Force correct z-index for blog page footer */
.blog footer, footer#footer, .blog-grid-section ~ footer {
    z-index: 1 !important;
}

/* ============================================
   Responsive Blog Tables - Horizontal Scroll
   ============================================ */

/* Table scroll wrapper - applied via JavaScript */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
    border-radius: 12px;
}

@media screen and (max-width: 768px) {
    .table-scroll-wrapper {
        /* Scroll shadow indicators */
        background:
            linear-gradient(to right, rgba(15, 23, 42, 1) 30%, transparent),
            linear-gradient(to left, rgba(15, 23, 42, 1) 30%, transparent),
            linear-gradient(to right, rgba(99, 102, 241, 0.3), transparent 15px),
            linear-gradient(to left, rgba(99, 102, 241, 0.3), transparent 15px);
        background-position: left center, right center, left center, right center;
        background-repeat: no-repeat;
        background-size: 40px 100%, 40px 100%, 15px 100%, 15px 100%;
        background-attachment: local, local, scroll, scroll;
    }

    .table-scroll-wrapper .comparison-table {
        min-width: 550px;
        margin: 0;
    }

    /* Scrollbar styling - webkit */
    .table-scroll-wrapper::-webkit-scrollbar {
        height: 8px;
    }

    .table-scroll-wrapper::-webkit-scrollbar-track {
        background: rgba(15, 23, 42, 0.5);
        border-radius: 4px;
    }

    .table-scroll-wrapper::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, var(--primary), var(--secondary));
        border-radius: 4px;
    }

    .table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(90deg, var(--secondary), var(--primary));
    }

    /* Firefox scrollbar */
    .table-scroll-wrapper {
        scrollbar-width: thin;
        scrollbar-color: var(--primary) rgba(15, 23, 42, 0.5);
    }

    /* Ensure table cells have proper padding */
    .table-scroll-wrapper .comparison-table td,
    .table-scroll-wrapper .comparison-table th {
        padding: 0.75rem 1rem;
        white-space: nowrap;
    }

    /* Allow wrapping for content cells (not first column) */
    .table-scroll-wrapper .comparison-table td:not(:first-child),
    .table-scroll-wrapper .comparison-table th:not(:first-child) {
        white-space: normal;
        min-width: 140px;
    }
}

/* Smaller mobile devices - tighter spacing */
@media screen and (max-width: 480px) {
    .table-scroll-wrapper .comparison-table td,
    .table-scroll-wrapper .comparison-table th {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}
