/* تبديل اللغة + دعم الشاشات الصغيرة والـ safe area */
#dido-lang-switch {
    position: fixed;
    bottom: max(14px, env(safe-area-inset-bottom, 14px));
    z-index: 2400;
    display: flex;
    gap: 0;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
    font-family: 'Cairo', system-ui, sans-serif;
    font-weight: 800;
    font-size: 0.75rem;
    border: 1px solid rgba(15, 23, 42, 0.12);
}
html[dir="rtl"] #dido-lang-switch {
    right: max(12px, env(safe-area-inset-right, 12px));
    left: auto;
}
html[dir="ltr"] #dido-lang-switch {
    left: max(12px, env(safe-area-inset-left, 12px));
    right: auto;
}

/* داخل لوحة التاجر الشريط العلوي — تنسيق مختلف */
#dido-lang-switch.dido-lang-switch--in-topbar {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none;
    touch-action: manipulation;
}

body.merchant-dashboard.dash-shell #dido-lang-switch.dido-lang-switch--in-topbar {
    font-size: 0.73rem;
    font-weight: 800;
}

body.merchant-dashboard.dash-shell #dido-lang-switch.dido-lang-switch--in-topbar:not(.dido-lang-switch--topbar-pill) button {
    min-height: 36px;
    padding: 6px 12px;
    min-width: 44px;
}

/* لوحة التاجر — زر واحد يغطي السهم والنص والكرة حتى يعمل النقر بالكامل */
#dido-lang-switch.dido-lang-switch--topbar-pill {
    overflow: visible;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    gap: 0.4rem;
    padding: 0.28rem 0.65rem 0.28rem 0.45rem;
    border-radius: 0.7rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: none;
    font-family: "Cairo", "Tajawal", system-ui, sans-serif;
    font-weight: 700;
    font-size: 0.8125rem;
    color: #475569;
    cursor: pointer;
    width: auto;
    max-width: 100%;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

#dido-lang-switch.dido-lang-switch--topbar-pill:focus-visible {
    box-shadow:
        0 0 0 2px #fff,
        0 0 0 4px rgba(37, 99, 235, 0.45);
}

#dido-lang-switch.dido-lang-switch--topbar-pill:hover {
    border-color: rgba(37, 99, 235, 0.35);
    background: #f8fafc;
}

#dido-lang-switch.dido-lang-switch--topbar-pill .dido-lang-switch__chev {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    flex-shrink: 0;
    color: #64748b;
    pointer-events: none;
}

#dido-lang-switch.dido-lang-switch--topbar-pill .dido-lang-switch__chev-icon {
    font-size: 0.62rem;
    pointer-events: none;
}

#dido-lang-switch.dido-lang-switch--topbar-pill .dido-lang-switch__label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    line-height: 1.3;
    pointer-events: none;
}

#dido-lang-switch.dido-lang-switch--topbar-pill .dido-lang-switch__globe {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.88rem;
    flex-shrink: 0;
    pointer-events: none;
}
#dido-lang-switch button {
    padding: 10px 14px;
    border: none;
    background: #fff;
    color: #475569;
    cursor: pointer;
    min-height: 44px;
    min-width: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
#dido-lang-switch button.active {
    background: #0f172a;
    color: #fff;
}
#dido-lang-switch button:not(.active):hover {
    background: #f1f5f9;
}

/* منع تكبير غير مقصود على iOS للحقول */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

.dido-mobile-pad {
    padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
}

@media (max-width: 420px) {
    .dido-store-grid-tight {
        grid-template-columns: 1fr !important;
    }
}

/* رفع زر واتساب قليلاً حتى لا يتداخل مع شريط تبديل اللغة */
.wa-fab {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
}
html[dir="ltr"] .wa-fab {
    right: auto;
    left: max(18px, env(safe-area-inset-left, 18px));
}
