/**
 * GTR Auto Browser-Native Translation & Compact Fallback Styles
 *
 * @package GTR_Auto
 */

/* ==========================================================================
   1. Compact Fallback Modal Dialog (400-480px)
   ========================================================================== */

.gtr-fallback-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 12, 16, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gtr-fallback-modal-backdrop.is-active {
    opacity: 1;
    visibility: visible;
}

.gtr-fallback-modal-container {
    background: #14171d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(229, 62, 62, 0.15);
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 1.25rem 1.5rem;
    position: relative;
    box-sizing: border-box;
}

.gtr-fallback-modal-backdrop.is-active .gtr-fallback-modal-container {
    transform: translateY(0) scale(1);
}

.gtr-fallback-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.gtr-fallback-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.2rem 0;
    line-height: 1.3;
}

.gtr-fallback-modal-subtitle {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
}

.gtr-fallback-modal-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.75rem;
}

.gtr-fallback-modal-close:hover,
.gtr-fallback-modal-close:focus {
    background: rgba(229, 62, 62, 0.2);
    border-color: #e53e3e;
    color: #ffffff;
    outline: none;
}

.gtr-fallback-lead {
    font-size: 0.875rem;
    color: #cbd5e1;
    margin: 0 0 0.875rem 0;
    line-height: 1.45;
}

.gtr-fallback-instruction-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
}

.gtr-fallback-instruction-text {
    font-size: 0.85rem;
    color: #f1f5f9;
    line-height: 1.5;
    margin: 0;
}

.gtr-fallback-modal-footer {
    display: flex;
    justify-content: flex-end;
}

.gtr-fallback-action-btn {
    background-color: #e21b2d;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1.25rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    width: 100%;
    text-align: center;
}

.gtr-fallback-action-btn:hover,
.gtr-fallback-action-btn:focus {
    background-color: #c51625;
    outline: none;
}

/* ==========================================================================
   2. Header Language Switcher Button States
   ========================================================================== */

.gtr-lang-switcher {
    user-select: none;
    -webkit-user-select: none;
}

.gtr-lang-btn {
    transition: color 0.15s ease, opacity 0.15s ease;
    cursor: pointer;
}

.gtr-lang-btn.active {
    color: #e21b2d !important;
    font-weight: 700 !important;
    cursor: default;
}

.gtr-lang-btn:not(.active) {
    color: #b3b7bc !important;
    font-weight: 500 !important;
}

.gtr-lang-btn:not(.active):hover {
    color: #ffffff !important;
}

.gtr-lang-switcher[data-translating="true"] {
    position: relative;
    opacity: 0.85;
    pointer-events: none;
}

.gtr-lang-switcher[data-translating="true"]::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border: 1.5px solid #e21b2d;
    border-top-color: transparent;
    border-radius: 50%;
    animation: gtrTranslateSpinner 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes gtrTranslateSpinner {
    to { transform: rotate(360deg); }
}

/* Floating Status Toast (Non-blocking notification) */
.gtr-translate-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #14171d;
    border: 1px solid rgba(226, 27, 45, 0.4);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    color: #f1f5f9;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 99990;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.gtr-translate-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.gtr-translate-toast-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #e21b2d;
    border-top-color: transparent;
    border-radius: 50%;
    animation: gtrTranslateSpinner 0.6s linear infinite;
}

/* ==========================================================================
   3. Utility & Accessibility
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   4. Japanese Session Mode & Handoff Navigation
   ========================================================================== */

/* Prevent English flash during early cached translation restore */
html.gtr-ja-session-pending body {
    opacity: 0;
    transition: opacity 0.15s ease-in;
}

/* Slim Top Navigation Handoff Progress Bar */
#gtr-handoff-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: #e21b2d;
    z-index: 100000;
    transition: width 0.2s ease, opacity 0.3s ease;
    width: 0%;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(226, 27, 45, 0.8);
}

#gtr-handoff-progress-bar.is-active {
    opacity: 1;
}

/* Compact Floating Continuation Pill (for direct untranslated URLs in JA mode) */
.gtr-continue-ja-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: #14171d;
    border: 1px solid rgba(226, 27, 45, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    color: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 99995;
    animation: gtrSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gtr-continue-ja-btn {
    background: #e21b2d;
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.gtr-continue-ja-btn:hover {
    background: #c51625;
}

@keyframes gtrSlideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
