/**
 * Instant Multi-Language Translator - Frontend Stylesheet
 * Works on any WordPress theme
 */

/* ==========================================================================
   1. Google Translate Core Override (Anti-Banner & Layout Protection)
   ========================================================================== */
body {
    top: 0px !important;
    position: static !important;
}

.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-tooltip,
.goog-tooltip:hover {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    pointer-events: none !important;
}

body > .skiptranslate:first-child {
    display: none !important;
}

.goog-text-highlight {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

#wp_google_translate_hidden_container,
.imt-hidden-engine {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ==========================================================================
   2. Floating Language Switcher Widget
   ========================================================================== */
.imt-floating-container {
    position: fixed;
    z-index: 999998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    direction: ltr;
}

/* Positions */
.imt-pos-bottom-right {
    bottom: 24px;
    right: 24px;
}
.imt-pos-bottom-left {
    bottom: 24px;
    left: 24px;
}
.imt-pos-top-right {
    top: 24px;
    right: 24px;
}
.imt-pos-top-left {
    top: 24px;
    left: 24px;
}

/* Floating Trigger Button */
.imt-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    padding: 9px 16px;
    border-radius: 9999px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}

.imt-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
    border-color: rgba(255, 255, 255, 0.35);
}

.imt-trigger-btn:active {
    transform: translateY(0);
}

.imt-trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.imt-trigger-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.imt-trigger-text {
    font-size: 13.5px;
    letter-spacing: 0.2px;
}

.imt-trigger-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    opacity: 0.7;
    margin-left: 2px;
    font-size: 11px;
}

.imt-floating-container.active .imt-trigger-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   3. Dropdown Language Modal / Panel
   ========================================================================== */
.imt-dropdown-panel {
    display: none;
    position: absolute;
    width: 290px;
    max-height: 440px;
    background: #ffffff;
    color: #1e293b;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    flex-direction: column;
    animation: imtFadeSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    z-index: 999999;
}

.imt-floating-container.active .imt-dropdown-panel {
    display: flex;
}

/* Alignment relative to trigger */
.imt-pos-bottom-right .imt-dropdown-panel {
    bottom: 52px;
    right: 0;
}
.imt-pos-bottom-left .imt-dropdown-panel {
    bottom: 52px;
    left: 0;
}
.imt-pos-top-right .imt-dropdown-panel {
    top: 52px;
    right: 0;
}
.imt-pos-top-left .imt-dropdown-panel {
    top: 52px;
    left: 0;
}

@keyframes imtFadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Panel Header */
.imt-panel-header {
    padding: 14px 16px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.imt-panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.imt-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.imt-panel-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.imt-panel-close-btn:hover {
    color: #1e293b;
    background: #e2e8f0;
}

/* Search input */
.imt-search-wrap {
    position: relative;
    width: 100%;
}

.imt-search-input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    background: #ffffff;
    color: #1e293b;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.imt-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.imt-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 12px;
    pointer-events: none;
}

/* Languages List container */
.imt-lang-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    max-height: 320px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.imt-lang-list::-webkit-scrollbar {
    width: 5px;
}
.imt-lang-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Language item */
.imt-lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.imt-lang-item:hover {
    background: #f1f5f9;
}

.imt-lang-item.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}

.imt-lang-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.imt-lang-flag {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.imt-lang-names {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.imt-lang-native {
    font-size: 13.5px;
    color: inherit;
    font-weight: 600;
    line-height: 1.2;
}

.imt-lang-eng {
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.2;
    margin-top: 1px;
}

.imt-lang-item.active .imt-lang-eng {
    color: #3b82f6;
}

.imt-lang-check {
    display: none;
    color: #2563eb;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.imt-lang-item.active .imt-lang-check {
    display: inline-block;
}

/* ==========================================================================
   4. Shortcode & Inline Styles ([imt_translator])
   ========================================================================== */
.imt-inline-wrap {
    display: inline-block;
    position: relative;
    font-family: inherit;
    vertical-align: middle;
}

.imt-inline-select {
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23475569'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 16px;
    padding: 8px 32px 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    color: #1e293b;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.imt-inline-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* Menu Item specific */
.menu-item .imt-inline-wrap {
    margin: 0 8px;
}

/* ==========================================================================
   5. Themes / Color Presets
   ========================================================================== */
/* Spiritual / Saffron Theme */
.imt-theme-saffron .imt-trigger-btn {
    background: linear-gradient(135deg, #D35400 0%, #E67E22 100%);
    border-color: rgba(255, 255, 255, 0.3);
    color: #FFFFFF;
}
.imt-theme-saffron .imt-lang-item.active {
    background: #FFF4E5;
    color: #D35400;
}
.imt-theme-saffron .imt-lang-check {
    color: #D35400;
}

/* Dark Gold Theme */
.imt-theme-dark-gold .imt-trigger-btn {
    background: #18120c;
    border-color: #D4AF37;
    color: #FDF9F1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(212, 175, 55, 0.3);
}
.imt-theme-dark-gold .imt-lang-item.active {
    background: #FDF6E2;
    color: #996515;
}
.imt-theme-dark-gold .imt-lang-check {
    color: #996515;
}

/* Clean White / Light Theme */
.imt-theme-light .imt-trigger-btn {
    background: #ffffff;
    color: #1e293b;
    border-color: #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.imt-theme-light .imt-trigger-btn:hover {
    border-color: #cbd5e1;
}

/* ==========================================================================
   6. Mobile Responsiveness
   ========================================================================== */
@media (max-width: 640px) {
    .imt-floating-container {
        bottom: 16px;
        right: 16px;
    }
    .imt-pos-bottom-left {
        bottom: 16px;
        left: 16px;
    }
    .imt-dropdown-panel {
        width: calc(100vw - 32px);
        max-width: 320px;
    }
}
