/**
 * Dypns 短信认证 - 前端样式
 * 兼容 PC 浏览器和手机浏览器
 */

/* === 隐藏模板容器（页脚渲染，由 JS 克隆注入） === */
#dypns-templates {
    display: none !important;
    position: absolute;
    left: -9999px;
}

/* === 容器 === */
.dypns-sms-container {
    margin: 20px 0;
    padding: 0;
}

/* 当所有可见字段已移出时，隐藏容器空白 */
.dypns-sms-container:empty,
.dypns-sms-container.dypns-container-minimal {
    margin: 0;
    padding: 0;
}

.dypns-sms-section {
    padding: 0;
}

/* === 表单字段 === */
.dypns-field {
    margin-bottom: 16px;
}

.dypns-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
    font-size: 14px;
}

.dypns-required {
    color: #dc3545;
}

.dypns-field input[type="tel"],
.dypns-field input[type="text"] {
    width: 100%;
    height: 42px;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
    outline: none;
    -webkit-appearance: none;
}

.dypns-field input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* === 验证码字段（注入到 RM 手机号字段下方时使用） === */
.dypns-code-field.dypns-relocated {
    margin-top: 18px !important;
    margin-bottom: 12px !important;
    padding-top: 0 !important;
}

.dypns-code-field.dypns-relocated label {
    font-size: 13px;
}

.dypns-code-field.dypns-relocated .dypns-code-input-wrapper {
    height: 38px;
}

.dypns-code-field.dypns-relocated .dypns-code-input-wrapper .dypns-code-input {
    font-size: 13px;
}

.dypns-code-field.dypns-relocated .dypns-send-btn {
    font-size: 12px;
    line-height: 38px;
}

/* === 验证码输入行（输入框 + 链接文本合为一体） === */
.dypns-code-row {
    margin-bottom: 0;
}

.dypns-code-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    height: 42px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    background: #fff;
}

.dypns-code-input-wrapper:focus-within {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.dypns-code-input-wrapper .dypns-code-input {
    flex: 2;
    min-width: 0;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    height: 100% !important;
    padding: 6px 12px;
    font-size: 15px;
    background: transparent;
    box-sizing: border-box;
    -webkit-appearance: none;
    border-radius: 0;
}

/* === 发送验证码链接文本 === */
.dypns-send-btn {
    flex: 1;
    flex-shrink: 0;
    white-space: nowrap;
    height: 100%;
    padding: 0 12px 0 10px;
    font-size: 13px;
    font-weight: 500;
    border: none !important;
    border-left: 1px solid #e0e0e0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #2271b1 !important;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 42px;
    box-sizing: border-box;
    -webkit-appearance: none;
    text-shadow: none;
}

.dypns-send-btn:hover:not(:disabled) {
    color: #135e96 !important;
    text-decoration: underline;
    background: transparent !important;
}

.dypns-send-btn:disabled {
    color: #999 !important;
    cursor: not-allowed;
    opacity: 0.85;
    background: transparent !important;
}

/* === 提示文字 === */
.dypns-tip {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
}

/* === 消息提示框 === */
.dypns-message {
    display: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin: 8px 0 16px;
    line-height: 1.5;
}

.dypns-msg-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.dypns-msg-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* === 登录标签切换 === */
.dypns-login-tabs-wrapper {
    margin-bottom: 20px;
}

.dypns-login-tabs {
    display: flex;
    border-bottom: 2px solid #e5e5e5;
    gap: 4px;
}

.dypns-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-bottom: none;
    background: #2271b1 !important;
    font-size: 16px;
    font-weight: 700;
    color: #fff !important;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.dypns-tab:hover,
.dypns-tab-active {
    color: #fff !important;
    background: #135e96 !important;
    border-bottom-color: #0a4b78;
}

/* === 短信登录面板 === */
.dypns-sms-login-panel {
    padding: 4px 0;
}

/* 登录模式的 SMS 容器不需要额外间距 */
.dypns-sms-container[data-form-type="login"] {
    margin: 0;
}

.dypns-sms-login-panel .dypns-field input {
    height: 40px;
}

/* === 登录/注册按钮行 === */
.dypns-btn-row {
    display: flex;
    gap: 12px;
    margin-top: 35px;
    margin-bottom: 35px;
}

.dypns-login-btn,
.dypns-register-btn {
    flex: 1;
    height: 44px;
    min-height: 44px;
    box-sizing: border-box;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 44px;
    padding: 0;
    white-space: nowrap;
}

.dypns-login-btn {
    background-color: #2271b1;
    color: #fff;
}

.dypns-register-btn {
    background-color: #2271b1;
    color: #fff;
}

.dypns-login-btn:hover:not(:disabled) {
    background-color: #135e96;
}

.dypns-register-btn:hover {
    background-color: #135e96;
    color: #fff;
    text-decoration: none;
}

.dypns-login-btn:disabled {
    background-color: #c3c4c7;
    cursor: not-allowed;
}

/* === 响应式（手机浏览器适配） === */
@media (max-width: 480px) {
    .dypns-code-input-wrapper {
        height: 44px;
    }

    .dypns-send-btn {
        font-size: 12px;
        padding: 0 8px 0 6px;
        line-height: 44px;
    }

    .dypns-tab {
        font-size: 14px;
        padding: 10px 10px;
    }

    .dypns-btn-row {
        flex-direction: column;
        gap: 8px;
    }

    .dypns-field input[type="tel"],
    .dypns-field input[type="text"] {
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
}
