/**
 * Te Reo Kuki Airani Translator — Frontend Styles
 *
 * Styles for the floating toggle button, inline toggle,
 * and translation status indicator.
 */

/* ============================================================
   Toggle Button — Shared Styles
   ============================================================ */

.tereo-toggle-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1;
    z-index: 999999;
}

.tereo-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #1a5276 0%, #148f77 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    outline: none;
    user-select: none;
}

.tereo-toggle-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.tereo-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tereo-toggle-btn:focus-visible {
    outline: 3px solid #f39c12;
    outline-offset: 2px;
}

/* Flags */
.tereo-flag {
    font-size: 20px;
    line-height: 1;
}

/* Labels */
.tereo-label {
    font-size: 13px;
    letter-spacing: 0.02em;
    transition: opacity 0.3s ease;
}

.tereo-label--en {
    opacity: 1;
}

.tereo-label--rar {
    opacity: 0.6;
}

/* Toggle Switch Track */
.tereo-switch {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.25);
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.tereo-switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active state (Te Reo mode) */
.tereo-toggle-btn[aria-pressed="true"] .tereo-switch {
    background: rgba(255, 255, 255, 0.4);
}

.tereo-toggle-btn[aria-pressed="true"] .tereo-switch-knob {
    transform: translateX(18px);
}

.tereo-toggle-btn[aria-pressed="true"] .tereo-label--en {
    opacity: 0.6;
}

.tereo-toggle-btn[aria-pressed="true"] .tereo-label--rar {
    opacity: 1;
}

/* ============================================================
   Floating Position (bottom-right)
   ============================================================ */

.tereo-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
}

/* ============================================================
   Inline (shortcode) — no fixed positioning
   ============================================================ */

.tereo-inline {
    display: inline-block;
    margin: 8px 0;
}

/* ============================================================
   Status Indicator
   ============================================================ */

.tereo-status {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    animation: tereo-fade-in 0.2s ease;
}

.tereo-status.tereo-status--visible {
    display: block;
}

.tereo-floating .tereo-status {
    /* Position above the floating button */
}

.tereo-inline .tereo-status {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    bottom: auto;
    right: auto;
}

@keyframes tereo-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Translation in progress — subtle pulse on translated elements
   ============================================================ */

.tereo-translating {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.tereo-translated {
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* ============================================================
   Responsive adjustments
   ============================================================ */

@media (max-width: 480px) {
    .tereo-floating {
        bottom: 16px;
        right: 16px;
    }

    .tereo-toggle-btn {
        padding: 8px 14px;
        font-size: 12px;
        gap: 6px;
    }

    .tereo-flag {
        font-size: 18px;
    }

    .tereo-switch {
        width: 34px;
        height: 18px;
        border-radius: 9px;
    }

    .tereo-switch-knob {
        width: 12px;
        height: 12px;
        top: 3px;
        left: 3px;
    }

    .tereo-toggle-btn[aria-pressed="true"] .tereo-switch-knob {
        transform: translateX(16px);
    }
}
