
/* ── Trigger button ── */
.open-btn {
    padding: 12px 32px;
    background: #ff4200;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.open-btn:hover { background: #2563eb; }
.open-btn:active { background: #1d4ed8; }

/* ── Overlay ── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ── Modal card — PC default ── */
.modal {
    background: #fff;
    border-radius: 16px;
    width: 420px;
    max-width: calc(100vw - 32px);
    padding: 36px 36px 32px;
    position: relative;
    transform: translateY(16px);
    transition: transform 0.25s;
    max-height: 90vh;
    overflow-y: auto;
}
.overlay.active .modal { transform: translateY(0); }

/* ── Drag handle (WAP only, hidden on PC) ── */
.drag-handle {
    display: none;
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 20px;
}

/* Close */
.close-btn {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}
.close-btn:hover { color: #374151; }

/* Logo area */
.modal-logo {
    text-align: center;
    margin-bottom: 24px;
}
.modal-logo .logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #eff6ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.modal-logo .logo-icon svg { width: 24px; height: 24px; }
.modal-logo h2 {
    font-size: 18px;
    font-weight: 500;
    color: #111827;
}

/* ── Tab bar ── */
.tabs {
    display: flex;
    border-bottom: 1.5px solid #e5e7eb;
    margin-bottom: 17px;
    gap: 0;
}
.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 4px 12px;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: color 0.15s;
    font-weight: 400;
    -webkit-tap-highlight-color: transparent;
}
.tab-btn.active {
    color: #ff4200;
    font-weight: 600;
}
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1.5px;
    left: 16%;
    right: 16%;
    height: 2px;
    background: #ff4200;
    border-radius: 2px;
}

/* ── Tab panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Form ── */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
    font-weight: 400;
}
.field .input-wrap {
    position: relative;
}
.field input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
}
.field input:focus {
    border-color: #ff4200;
}
.field input::placeholder { color: #9ca3af; }

/* Password toggle */
.pwd-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 6px;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}
.pwd-toggle:hover { color: #6b7280; }

/* Code input row */
.code-row {
    display: flex;
    gap: 8px;
}
.code-row input {
    flex: 1;
    min-width: 0;
}
.send-code-btn {
    white-space: nowrap;
    padding: 0 14px;
    height: 42px;
    background: #ff4200;
    color: #eff6ff;
    border: 1px solid #ff4200;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    font-weight: 400;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.send-code-btn:hover { background: #dbeafe; }
.send-code-btn:active { background: #bfdbfe; }
.send-code-btn:disabled {
    color: #9ca3af;
    background: #f9fafb;
    border-color: #e5e7eb;
    cursor: default;
}

/* Extra row: remember / forgot */
.form-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 13px;
}
.remember {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}
.remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #ff4200;
}
.forgot-link {
    color: #ff4200;
    text-decoration: none;
    font-size: 13px;
}
.forgot-link:hover { text-decoration: underline; }

/* Agreement */
.agreement {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 20px;
    line-height: 1.5;
}
.agreement input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    accent-color: #ff4200;
    flex-shrink: 0;
}
.agreement a { color: #ff4200; text-decoration: none; }
.agreement a:hover { text-decoration: underline; }

/* Submit button */
.submit-btn {
    width: 100%;
    height: 44px;
    background: #ff4200;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 0;
    -webkit-tap-highlight-color: transparent;
}
/* ── Bottom switch ── */
.switch-row {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    margin-top: 16px;
}
.switch-row a {
    color: #ff4200;
    text-decoration: none;
    cursor: pointer;
}
.switch-row a:hover { text-decoration: underline; }

/* ── Shared social footer ──
   三方登录统一放在弹窗底部，所有 tab 共用
── */
.social-footer {
    padding-top: 20px;
}
/* ── Login tip ── */
.login-tip {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #ff4200;
    border-radius: 6px;
    line-height: 1.4;
    justify-content: center;
}
/* ── Divider ── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #9ca3af;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Third-party login ── */
.social-row {
    display: flex;
    justify-content: center;
    gap: 16px;
}
.social-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.social-btn:hover { border-color: #d1d5db; background: #f9fafb; }
.social-btn:active { background: #eff6ff; }
.social-btn svg { width: 20px; height: 20px; }

/* ════════════════════════════════════════════
   WAP — 480px 及以下：底部弹起全宽 Sheet
════════════════════════════════════════════ */
@media (max-width: 480px) {
    body { -webkit-text-size-adjust: 100%; }

    /* Overlay 底部对齐 */
    .overlay {
        align-items: flex-end;
        justify-content: center;
    }

    /* Modal 变为底部 Sheet */
    .modal {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 8px 20px max(32px, env(safe-area-inset-bottom, 32px));
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        max-height: 92vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .overlay.active .modal { transform: translateY(0); }

    /* 显示拖动条 */
    .drag-handle { display: block; }

    /* 关闭按钮适配 */
    .close-btn {
        top: 20px;
        right: 16px;
        font-size: 18px;
    }

    /* Logo 缩小间距 */
    .modal-logo { margin-bottom: 16px; }
    .modal-logo h2 { font-size: 17px; }

    /* Tab 字号稍大，点击区域更好触控 */
    .tab-btn {
        font-size: 15px;
        padding: 10px 4px 14px;
    }
    .tabs { margin-bottom: 20px; }

    /* 表单字段行距稍宽 */
    .field { margin-bottom: 14px; }
    .field label { font-size: 14px; }

    /* 输入框高度更大，触控更友好 */
    .field input {
        height: 48px;
        font-size: 16px; /* 防止 iOS 自动缩放 */
        padding: 0 16px;
        border-radius: 10px;
    }

    /* 验证码按钮 */
    .send-code-btn {
        height: 48px;
        font-size: 14px;
        padding: 0 12px;
        border-radius: 10px;
    }

    /* 提交按钮更高 */
    .submit-btn {
        height: 50px;
        font-size: 16px;
        border-radius: 12px;
    }

    /* 三方登录图标稍大 */
    .social-btn {
        width: 50px;
        height: 50px;
    }
    .social-btn svg { width: 22px; height: 22px; }
    .social-row { gap: 20px; }

    /* 底部切换文字 */
    .switch-row { font-size: 14px; }

    /* 记住我 & 忘记密码 */
    .form-extra { font-size: 14px; }
    .forgot-link { font-size: 14px; }

    /* 协议文字 */
    .agreement { font-size: 13px; margin-bottom: 16px; }

    /* 共享底部 */
    .social-footer { margin-top: 16px; padding-top: 16px; }
    .divider { margin-bottom: 12px; }
}

/* ════════════════════════════════════════════
   平板及中等屏幕 481px–768px
════════════════════════════════════════════ */
@media (min-width: 481px) and (max-width: 768px) {
    .modal {
        width: 380px;
        padding: 30px 28px 28px;
    }
    .field input { height: 44px; font-size: 15px; }
    .send-code-btn { height: 44px; }
    .submit-btn { height: 46px; }
}

/* ── Scrollbar thin style (Webkit) ── */
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
