/* seiu-translations: frontend styles */

/* -------------------------------------------------------------------------
   Translatable block wrapper
   ------------------------------------------------------------------------- */

.seiu-translatable {
    position: relative;
    overflow: visible !important;  /* override any theme overflow:hidden on block wrappers */
}

/* Hide all language variants by default */
.seiu-lang-content {
    display: none;
}

/* Show only the active language */
.seiu-translatable[data-active-lang="en"]    .seiu-lang-content[data-lang="en"],
.seiu-translatable[data-active-lang="es"]    .seiu-lang-content[data-lang="es"],
.seiu-translatable[data-active-lang="zh-TW"] .seiu-lang-content[data-lang="zh-TW"],
.seiu-translatable[data-active-lang="fil"]   .seiu-lang-content[data-lang="fil"] {
    display: block;
}

/* -------------------------------------------------------------------------
   Per-block override indicator
   ------------------------------------------------------------------------- */

/* Desktop: flag badge presence is the indicator — no border needed */
/* Mobile: 4px gray left border when block has a manual override */
@media ( max-width: 640px ) {
    .seiu-translatable[data-overridden="true"] {
        border-left: 4px solid #9e9e9e;
        padding-left: 10px;
    }
}

/* -------------------------------------------------------------------------
   Awaiting translation notice
   ------------------------------------------------------------------------- */

.seiu-awaiting-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 3px;
    font-size: 12px;
    color: #92400e;
    font-style: italic;
}

.seiu-awaiting-icon {
    font-size: 14px;
}

/* -------------------------------------------------------------------------
   Per-block flag badge
   ------------------------------------------------------------------------- */

.seiu-lang-badge {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.1s ease;
    z-index: 10;
    /* No built-in button styles */
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    user-select: none;
}

/* Show on hover (desktop) */
@media ( hover: hover ) {
    .seiu-translatable:hover .seiu-lang-badge {
        opacity: 1;
    }
}

/* Always visible when overridden (desktop — so the steward can see it) */
@media ( hover: hover ) {
    .seiu-translatable[data-overridden="true"] .seiu-lang-badge {
        opacity: 1;
        background: rgba(255, 255, 255, 0.95);
        border-color: rgba(0, 0, 0, 0.2);
    }
}

/* Swipe handle — shown by default, hidden on devices with a real hover pointer */
.seiu-swipe-handle {
    position: absolute;
    top: 0;
    right: -4px;
    bottom: 0;
    width: 28px;
    min-height: 44px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    /* Debug: set background: rgba(255,0,0,0.4) to verify placement */
}

/* Hide on desktop — hover badge handles it there */
@media ( hover: hover ) and ( pointer: fine ) {
    .seiu-swipe-handle {
        display: none;
    }
}

/* On touch devices: show badge only when picker is open */
@media not all and ( hover: hover ) and ( pointer: fine ) {
    .seiu-lang-badge {
        opacity: 0;
        pointer-events: none;
    }

    .seiu-translatable[data-picker-open="true"] .seiu-lang-badge {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Chevron affordance on overridden blocks */
.seiu-translatable[data-overridden="true"] .seiu-swipe-handle::before {
    content: '‹';
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY( -50% );
    font-size: 18px;
    color: #9e9e9e;
    opacity: 0.6;
    pointer-events: none;
}

.seiu-lang-badge:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.seiu-badge-flag {
    display: block;
    line-height: 1;
}

/* -------------------------------------------------------------------------
   Per-block language picker
   ------------------------------------------------------------------------- */

.seiu-lang-picker {
    display: none;
    position: absolute;
    top: calc( 100% + 4px );
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 100;
    overflow: hidden;
}

.seiu-lang-picker.is-open {
    display: block;
}

/* Flip upward when near bottom of viewport */
.seiu-lang-picker.flip-up {
    top: auto;
    bottom: calc( 100% + 4px );
}

/* Bottom sheet on mobile */
@media ( max-width: 640px ) {
    .seiu-lang-picker.is-bottom-sheet {
        position: fixed;
        top: auto !important;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        min-width: 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
        padding-bottom: env( safe-area-inset-bottom, 0px );
    }
}

.seiu-lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.seiu-lang-option:hover,
.seiu-lang-option:focus {
    background: #f3f4f6;
    outline: none;
}

.seiu-lang-option[aria-selected="true"] {
    background: #eff6ff;
    font-weight: 600;
    color: #1d4ed8;
}

/* -------------------------------------------------------------------------
   Global page-level language switcher (bottom-right fixed)
   ------------------------------------------------------------------------- */

.seiu-global-switcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

@media ( max-width: 640px ) {
    .seiu-global-switcher {
        bottom: 16px;
        right: 16px;
    }
}

.seiu-global-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: #1e293b;
    color: #fff;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    transition: background 0.15s, transform 0.1s;
    user-select: none;
}

.seiu-global-btn:hover {
    background: #0f172a;
    transform: translateY( -1px );
}

.seiu-global-btn:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.seiu-global-flag {
    font-size: 18px;
    line-height: 1;
}

.seiu-global-label {
    letter-spacing: 0.01em;
}

.seiu-global-panel {
    display: none;
    position: absolute;
    bottom: calc( 100% + 8px );
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.seiu-global-panel.is-open {
    display: block;
}

.seiu-global-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.seiu-global-option:hover {
    background: #f3f4f6;
}

.seiu-global-option.is-active {
    background: #eff6ff;
    font-weight: 600;
    color: #1d4ed8;
}

.seiu-global-option:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: -2px;
}
