/* ========================================================
   模态框组件
   ======================================================== */

body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .25s ease;
}

.modal-box.modal-wide {
    max-width: 520px;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #475569;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin: 12px 24px 0;
    border-bottom: 1px solid #e2e8f0;
}

.auth-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: #64748b;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.modal-body {
    padding: 16px 24px 24px;
}

/* 表单 */
.modal-body .form-group {
    margin-bottom: 14px;
}

.modal-body .form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}

.modal-body .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
}

.modal-body .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.modal-body .btn-submit {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    margin-top: 6px;
}

.modal-body .btn-submit:hover {
    background: var(--primary-dark);
}

.modal-body .btn-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* 弹窗内切换链接 */
.modal-switch {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    margin-top: 14px;
}

.modal-switch a {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.modal-switch a:hover {
    text-decoration: underline;
}

/* 消息提示 */
.modal-msg {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}

.modal-msg.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.modal-msg.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* 提示型弹窗（下载限制等） */
.modal-notice {
    text-align: center;
    padding: 8px 0;
}

.modal-notice .notice-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.modal-notice .notice-text {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-notice .btn-notice {
    padding: 10px 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.modal-notice .btn-notice:hover {
    background: var(--primary-dark);
}
