/* 弹窗样式优化 */
:root {
    --primary-dark: #0a1929;
    --primary-blue: #165DFF;
    --secondary-blue: #36BFFA;
    --tech-gray: #2d3748;
    --light-gray: #f8fafc;
    --text-light: #64748b;
    --text-dark: #1e293b;
    --accent-cyan: #00cffd;
    --background: #f1f5f9;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

/* 弹窗容器 */
.modal-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    /* backdrop-filter: blur(5px); */
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: auto;
    animation: modalFadeIn 0.3s ease-out;
}

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

/* 弹窗基础样式 */
.modal {
    display: none;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    position: relative;
    z-index: 10000;
    pointer-events: auto;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 加载弹窗特殊样式 */
#loading-modal {
    max-width: 200px;
    text-align: center;
    position: fixed;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 弹窗头部 */
.modal-header {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-cyan));
    box-shadow: 0 0 10px rgba(0, 207, 253, 0.3);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-dark);
    font-size: 18px;
    font-weight: 600;
}

/* 关闭按钮 */
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: var(--primary-blue);
    background-color: rgba(22, 93, 255, 0.1);
    transform: rotate(90deg);
}

/* 弹窗内容 */
.modal-body {
    padding: 24px;
    max-height: 70vh;
    /* overflow-y: auto; */
}

/* 表单组样式 */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: flex;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
    vertical-align: top;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.error-message {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 3px;
    display: block;
    line-height: 1.4;
    animation: errorFadeIn 0.3s ease-out;
}

.required {
    color: #ff4d4f;
    margin-left: 4px;
    display: inline;
}

.error-message {
    color: #ff4d4f;
    font-size: 12px;
    margin-left: 8px;
    display: inline;
    line-height: 1.4;
    animation: errorFadeIn 0.3s ease-out;
}

/* 输入框样式 */
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
    background-color: #ffffff;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 弹窗底部 */
.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #f8fafc;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(22, 93, 255, 0.3);
    position: relative;
    overflow: hidden;
    width: auto;
    height: auto;
}

.btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 93, 255, 0.4);
}

.btn-secondary {
    width: auto;
    height: auto;
    background-color: #ffffff;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(22, 93, 255, 0.1);
}

.btn-secondary:hover {
    background-color: rgba(22, 93, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(22, 93, 255, 0.2);
}

/* 错误提示样式 */
.error-message {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 3px;
    display: block;
    line-height: 1.4;
    animation: errorFadeIn 0.3s ease-out;
}

@keyframes errorFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 成功提示弹窗 */
.success-modal {
    text-align: center;
}

.success-modal h4,
.success-modal p {
    color: var(--text-dark);
}

.success-icon {
    font-size: 48px;
    color: #4caf50;
    margin-bottom: 20px;
    animation: successPulse 1s ease-in-out;
}

@keyframes successPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 错误提示弹窗 */
.error-modal {
    text-align: center;
}

.error-modal h4,
.error-modal p {
    color: var(--text-dark);
}

.error-icon {
    font-size: 48px;
    color: #ff4d4f;
    margin-bottom: 20px;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* 警告提示弹窗 */
.warning-modal {
    text-align: center;
}

.warning-modal h4,
.warning-modal p {
    color: var(--text-dark);
}

.warning-icon {
    font-size: 48px;
    color: #ff9800;
    margin-bottom: 20px;
    animation: warningPulse 1s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* 信息提示弹窗 */
.info-modal {
    text-align: center;
}

.info-modal h4,
.info-modal p {
    color: var(--text-dark);
}

.info-icon {
    font-size: 48px;
    color: var(--primary-blue);
    margin-bottom: 20px;
    animation: infoFadeIn 0.5s ease-out;
}

@keyframes infoFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        max-width: 95%;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-close {
        font-size: 20px;
        width: 28px;
        height: 28px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: 60vh;
    }
    
    .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer button {
        width: 100%;
        text-align: center;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .btn-primary {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* 弹窗中的二维码容器 */
    #qrcode-modal .modal-body #qrcode-container,
    #qrcode-container {
        width: 160px !important;
        height: 160px !important;
        margin: 20px auto !important;
    }
    
    #qrcode-modal #login-status {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .modal {
        width: 98%;
        max-width: 98%;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 12px 15px;
    }
    
    .modal-header h3 {
        font-size: 15px;
    }
    
    .modal-body {
        padding: 15px;
        max-height: 55vh;
    }
    
    .modal-footer {
        padding: 12px 15px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .btn-primary {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    /* 弹窗中的二维码容器 */
    #qrcode-modal .modal-body #qrcode-container,
    #qrcode-container {
        width: 140px !important;
        height: 140px !important;
        margin: 15px auto !important;
    }
    
    #qrcode-modal #login-status {
        font-size: 12px;
    }
}

/* 加载动画 */
.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(22, 93, 255, 0.3);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-dark);
    font-size: 14px;
}

/* 确认对话框样式 */
.confirm-modal .modal-body {
    text-align: center;
    padding: 30px 24px;
}

.confirm-icon {
    font-size: 48px;
    color: var(--primary-blue);
    margin-bottom: 20px;
}

.confirm-message {
    color: var(--text-dark);
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.5;
}

/* 弹窗关闭动画 */
.modal.closing {
    animation: modalSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
}

.modal-container.closing {
    animation: modalFadeOut 0.3s ease-out;
}

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