/* 共用登入浮動視窗（首頁 / super-chart 體驗版等） */

/* 隔離頁面全域樣式，避免 super-chart 等頁面的 h2 / p / button 規則撐高卡片 */
.login-panel h1,
.login-panel h2,
.login-panel h3,
.login-panel p,
.login-panel form {
    margin: 0;
}

.login-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100050;
    padding: 24px;
    background: transparent;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

body.login-modal-open .login-panel {
    display: flex;
}

body.login-modal-open {
    overflow: hidden;
}

.login-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    border: none;
    padding: 0;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: loginBackdropIn 0.28s ease;
}

@keyframes loginBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.login-modal-close {
    position: absolute;
    top: calc(18px + env(safe-area-inset-top, 0px));
    right: calc(18px + env(safe-area-inset-right, 0px));
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(39, 39, 42, 0.95);
    color: #fafafa;
    border: 1px solid #3f3f46;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    max-height: min(90vh, 760px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #111116;
    border: 1px solid #27272a;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.login-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #71717a;
}

.login-title {
    margin: 10px 0 0;
    font-size: 26px;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: -0.01em;
}

.login-subtitle {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: #a1a1aa;
}

.login-section { margin-top: 28px; }

.login-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #a1a1aa;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.login-panel .field { margin-bottom: 12px; }

.login-panel .field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #d4d4d8;
    margin-bottom: 6px;
}

.login-panel .field input {
    width: 100%;
    padding: 11px 13px;
    font-size: 13.5px;
    font-family: inherit;
    background: #18181b;
    color: #fafafa;
    border: 1px solid #27272a;
    border-radius: 8px;
    box-sizing: border-box;
}

.login-panel .field input:focus {
    outline: none;
    border-color: #71717a;
    box-shadow: 0 0 0 3px rgba(161, 161, 170, 0.12);
}

.login-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    margin-bottom: 14px;
}

.login-help {
    font-size: 12px;
    color: #71717a;
    text-decoration: none;
}

.login-panel .btn-primary {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    color: #09090b;
    background: #fafafa;
    border: 1px solid #fafafa;
    border-radius: 8px;
    cursor: pointer;
}

.login-panel .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-error {
    display: none;
    margin-top: 10px;
    padding: 9px 12px;
    font-size: 12px;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.32);
    border-radius: 6px;
}

.login-error.is-show { display: block; }

.login-notice {
    display: none;
    margin: 0 0 18px;
    padding: 10px 12px;
    font-size: 12px;
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 6px;
}

.login-notice.is-show { display: block; }

.login-panel .divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 18px;
    color: #52525b;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-panel .divider::before,
.login-panel .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #27272a;
}

.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-panel .btn-social {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #fafafa;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    cursor: pointer;
}

.btn-social .ic {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.btn-social.line .ic {
    background: #06c755;
    color: #fff;
}

/* Google 自訂按鈕容器（與 LINE 相同樣式）*/
.google-btn-wrap {
    position: relative;
    width: 100%;
}

/* 視覺按鈕：外觀與 .btn-social 完全一致 */
.btn-social--google {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #fafafa;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
}

/* Google G 圖示：白底藍字，與 LINE 的綠底 L 對稱 */
.ic--google {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #4285f4;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 900;
    flex-shrink: 0;
    line-height: 1;
}

/* GSI iframe：透明疊在視覺按鈕上，接受點擊觸發 Google 登入 */
.google-host--overlay {
    position: absolute;
    inset: 0;
    opacity: 0;
    z-index: 2;
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto;
    border-radius: 8px;
}

.google-host--overlay > div {
    overflow: visible !important;
}

/* 基礎 google-host 樣式（非疊層狀態） */
.google-host {
    display: block;
    max-width: 100%;
    min-height: 40px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}

.google-host > div {
    display: block;
    max-width: 100%;
    line-height: 0;
}

.google-host iframe {
    display: block;
    margin: 0;
    border: 0;
    max-width: 100%;
}

.login-panel .legal {
    margin-top: 26px;
    font-size: 11px;
    color: #71717a;
    line-height: 1.6;
    text-align: center;
}

.login-panel .legal a {
    color: #a1a1aa;
    text-decoration: none;
}

@media (max-width: 768px) {
    .login-panel {
        padding: max(12px, env(safe-area-inset-top, 0px))
            max(16px, env(safe-area-inset-right, 0px))
            max(12px, env(safe-area-inset-bottom, 0px))
            max(16px, env(safe-area-inset-left, 0px));
    }

    .login-card {
        max-width: 100%;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
    }
}
