/* ── Translate Store v2.1 — Frontend Popup ── */

/* ─── Hide ONLY the visible Google Translate UI (NOT the widget engine) ── */
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate {
    display: none !important;
}

body {
    top: 0 !important;
    position: static !important;
}

.goog-tooltip,
.goog-tooltip:hover,
#goog-gt-tt,
.goog-te-balloon-frame {
    display: none !important;
}

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

/* Container MUST be in DOM (not display:none) for the widget to initialize.
   We position it off-screen instead. */
#google_translate_element {
    position: fixed !important;
    top: -10000px !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    z-index: -9999 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}


/* Default: ALWAYS hidden — 3 layers of protection */
#ts-overlay,
div#ts-overlay,
body #ts-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

/* Active: JS adds this class to show */
#ts-overlay.ts-active,
div#ts-overlay.ts-active,
body #ts-overlay.ts-active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    animation: ts-fade-in 0.3s ease;
}

@keyframes ts-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Popup Card ── */
#ts-popup {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px 36px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
    animation: ts-slide-up 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

@keyframes ts-slide-up {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Close Button ── */
#ts-close {
    position: absolute !important;
    top: 14px !important;
    right: 16px !important;
    width: 32px !important;
    height: 32px !important;
    border: none !important;
    background: #f0f0f0 !important;
    border-radius: 50% !important;
    font-size: 13px !important;
    color: #888 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding: 0 !important;
    box-shadow: none !important;
    transition: background 0.2s, color 0.2s;
}

#ts-close:hover {
    background: #ddd !important;
    color: #333 !important;
}

/* ── Header ── */
.ts-globe {
    font-size: 52px;
    margin-bottom: 16px;
    display: block;
}

.ts-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    margin: 0 0 8px !important;
    line-height: 1.3 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.ts-subtitle {
    font-size: 15px !important;
    color: #888 !important;
    margin: 0 0 28px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

/* ── Language Buttons ── */
.ts-lang-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 14px !important;
    margin-top: 8px !important;
}

.ts-lang-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 22px 16px !important;
    border: 2px solid #e8e8e8 !important;
    border-radius: 14px !important;
    background: #fafafa !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
    transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s !important;
    width: 100% !important;
}

.ts-lang-btn:hover {
    border-color: #FF6B00 !important;
    background: #fff5ee !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 24px rgba(255,107,0,0.2) !important;
}

.ts-lang-btn:active {
    transform: translateY(0) !important;
}

.ts-lang-btn.ts-loading {
    opacity: 0.6 !important;
    pointer-events: none !important;
}

.ts-flag {
    font-size: 40px !important;
    line-height: 1 !important;
    display: block !important;
}

.ts-name {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Arabic', sans-serif !important;
}

/* ── RTL ── */
body.rtl { direction: rtl; text-align: right; }
body.rtl .ts-lang-grid { direction: ltr; }

/* ── Mobile ── */
@media (max-width: 480px) {
    #ts-popup { padding: 28px 18px; border-radius: 16px; }
    .ts-globe  { font-size: 38px; }
    .ts-title  { font-size: 18px !important; }
    .ts-lang-btn { padding: 16px 10px !important; }
    .ts-flag   { font-size: 32px !important; }
}
