/* polymarkets.co.il — i18n RTL/LTR layer */
/* This file overrides directional styles with CSS Logical Properties */
/* Load AFTER style.css */

/* ═══ BASE: Remove hardcoded RTL, use [dir] attribute ═══ */
body {
    direction: unset; /* controlled by html[dir] */
}

/* ═══ FONT PER LANGUAGE ═══════════════════════════════ */
html[lang="he"] body { font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
html[lang="en"] body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
html[lang="ar"] body { font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
html[lang="pt"] body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
html[lang="hi"] body { font-family: 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ═══ SEARCH ICON — logical positioning ═══════════════ */
.header-search .search-icon {
    left: unset;
    right: unset;
    inset-inline-end: 12px;
}

.header-search input {
    padding: 7px 14px;
    padding-inline-end: 36px;
}

/* ═══ SUBNAV HOT DOT — logical margin ════════════════ */
.subnav a.hot::before {
    margin-left: unset;
    margin-right: unset;
    margin-inline-start: 6px;
}

/* ═══ MC-SEMI (half-circle gauge) — logical margin ═══ */
.mc-semi {
    margin-right: unset;
    margin-left: unset;
    margin-inline-end: auto;
    margin-inline-start: 0;
}

/* #101674: the blockquote + .toc-list a.active override blocks are retired - style.css now
   states the logical edge itself, so there is nothing left here to override. Retiring the TOC
   block also hands the guide sidebar back to its own newer .article-toc .toc-list rules, which
   this layer had been beating on cascade order alone. */

/* ═══ BREADCRUMB SEPARATOR — logical margin ═══════════ */
.breadcrumbs li::before {
    margin-left: unset;
    margin-right: unset;
    margin-inline-start: 6px;
}

/* ═══ VIEW FULL MARKET ARROW — flip for LTR ══════════ */
[dir="ltr"] .card.view_full,
[dir="ltr"] .section-link {
    direction: ltr; /* arrows point right in LTR */
}

/* ═══ CAROUSEL ANIMATION — flip for LTR ═════════════ */
[dir="ltr"] .featured-slide {
    animation-name: fadeSlide-ltr;
}

@keyframes fadeSlide-ltr {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ═══ LANGUAGE SWITCHER ══════════════════════════════ */
.lang-switcher {
    position: relative;
    flex-shrink: 0;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.lang-current:hover {
    border-color: var(--border-light);
    color: var(--text);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    margin-top: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    min-width: 140px;
    box-shadow: var(--shadow);
    z-index: 1100;
    display: none;
}

.lang-switcher:hover .lang-dropdown,
.lang-switcher:focus-within .lang-dropdown {
    display: block;
}

.lang-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.lang-dropdown a:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.lang-dropdown a.active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ═══ GOOGLE FONTS IMPORTS PER LANGUAGE ═══════════════ */
/* Loaded dynamically in template head based on current lang */

/* ═══ RESPONSIVE OVERRIDES ════════════════════════════ */
@media (max-width: 768px) {
    .lang-switcher { order: -1; }
}

/* ═══ HEADER LANGUAGE BUTTON (globe icon) ════════════ */
.hdr-lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border, #2a2f38);
    color: var(--text-secondary, #aab3c5);
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    transition: all var(--transition, 0.15s ease);
    font-size: 16px;
    padding: 0;
    flex-shrink: 0;
}
.hdr-lang-btn:hover {
    background: var(--bg-hover, rgba(255,255,255,0.05));
    border-color: var(--border-light, #3a4150);
    color: var(--text, #e7ebf3);
}
.hdr-lang-btn i {
    font-size: 16px;
    line-height: 1;
}

/* ═══ LANGUAGE MODAL ═══════════════════════════════ */
.lang-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: langModalFadeIn 0.18s ease;
}

@keyframes langModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lang-modal-box {
    background: var(--bg-surface, #131517);
    border: 1px solid var(--border, #2a2f38);
    border-radius: var(--radius, 14px);
    max-width: 540px;
    width: 100%;
    max-height: 82vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: langModalSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes langModalSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.lang-modal-x {
    position: absolute;
    top: 10px;
    inset-inline-end: 12px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-dim, #6b7280);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-sm, 8px);
    transition: all var(--transition, 0.15s ease);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lang-modal-x:hover {
    background: var(--bg-hover, rgba(255,255,255,0.05));
    color: var(--text, #e7ebf3);
}

.lang-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #e7ebf3);
    margin: 0 0 20px 0;
    text-align: center;
    padding-inline-end: 32px;
    padding-inline-start: 32px;
}

.lang-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
    gap: 8px;
}

.lang-opt {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-card, #1a1d21);
    border: 1px solid var(--border, #2a2f38);
    border-radius: var(--radius-sm, 8px);
    color: var(--text, #e7ebf3);
    text-decoration: none;
    transition: all var(--transition, 0.15s ease);
    cursor: pointer;
}
.lang-opt:hover {
    background: var(--bg-hover, rgba(255,255,255,0.06));
    border-color: var(--border-light, #3a4150);
    transform: translateY(-1px);
}
.lang-opt-active {
    border-color: var(--accent, #22d3ee);
    background: var(--accent-soft, rgba(34, 211, 238, 0.08));
}
.lang-opt-active:hover {
    border-color: var(--accent, #22d3ee);
}

.lang-opt-flag {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    overflow: hidden;
}
.lang-opt-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lang-opt-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.lang-opt-body strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #e7ebf3);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lang-opt-body small {
    font-size: 11px;
    color: var(--text-dim, #6b7280);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lang-opt-active .lang-opt-body strong {
    color: var(--accent, #22d3ee);
}

@media (max-width: 480px) {
    .lang-modal-box {
        padding: 24px 16px 20px;
    }
    .lang-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
    }
    .lang-opt {
        padding: 9px 10px;
        gap: 10px;
    }
}
