/* ============================================
   纠错弹窗独立组件 - error-modal.css
   统一蓝白风格，可在任意页面引入
   ============================================ */

/* ========== 弹窗容器 ========== */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.error-modal--show {
    opacity: 1;
    visibility: visible;
}

/* 遮罩层 */
.error-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* 弹窗主体 */
.error-modal__content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(30px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.error-modal--show .error-modal__content {
    transform: translateY(0) scale(1);
}

/* ========== 头部 ========== */
.error-modal__header {
    display: flex;
    align-items: center;
    padding: 24px 24px 20px;
    border-bottom: 1px solid #f3f4f6;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-radius: 16px 16px 0 0;
}

.error-modal__icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
    flex-shrink: 0;
}

.error-modal__icon i {
    color: #fff;
    font-size: 1.5rem;
}

.error-modal__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    flex: 1;
}

.error-modal__close {
    margin-left: auto;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.error-modal__close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.error-modal__close i {
    color: #6b7280;
    font-size: 1rem;
}

.error-modal__body {
    padding: 24px;
}

/* ========== 表单 ========== */
.error-form__group {
    margin-bottom: 24px;
}

.error-form__group:last-child {
    margin-bottom: 0;
}

.error-form__label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.error-form__required {
    color: #ef4444;
    margin-right: 3px;
}

/* ========== 单选按钮组 ========== */
.error-form__radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.error-form__radio {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
    user-select: none;
    background: #fff;
}

.error-form__radio:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.error-form__radio input {
    display: none;
}

.error-form__radio input:checked + .error-form__radio-mark {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #2563eb;
}

.error-form__radio input:checked + .error-form__radio-mark::after {
    opacity: 1;
    transform: scale(1);
}

.error-form__radio input:checked ~ span {
    color: #2563eb;
    font-weight: 600;
}

.error-form__radio:has(input:checked) {
    border-color: #3b82f6;
    background: #eff6ff;
}

.error-form__radio-mark {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    background: #fff;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.error-form__radio-mark::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* ========== 文本域 ========== */
.error-form__textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #374151;
    background: #fff;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.error-form__textarea::placeholder {
    color: #9ca3af;
}

.error-form__textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* ========== 验证码区域 ========== */
.error-form__captcha {
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-form__captcha-canvas {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-form__captcha-canvas:hover {
    border-color: #d1d5db;
}

/* 图片验证码模式 */
.error-form__captcha-img {
    width: 120px;
    height: 40px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
}

.error-form__captcha-img:hover {
    border-color: #d1d5db;
}

.error-form__captcha-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.error-form__captcha-refresh {
    width: 40px;
    height: 40px;
    border: 2px solid #e5e7eb;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.error-form__captcha-refresh:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.error-form__captcha-refresh i {
    color: #6b7280;
    font-size: 1.125rem;
    transition: transform 0.3s ease;
}

.error-form__captcha-refresh:hover i {
    color: #3b82f6;
    transform: rotate(180deg);
}

.error-form__captcha-input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    color: #374151;
    background: #fff;
    transition: all 0.2s ease;
    letter-spacing: 4px;
    font-weight: 600;
    text-transform: uppercase;
    box-sizing: border-box;
}

.error-form__captcha-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.error-form__captcha-input::placeholder {
    letter-spacing: normal;
    font-weight: normal;
    text-transform: none;
    color: #9ca3af;
}

/* ========== 操作按钮区 ========== */
.error-form__actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.error-form__btn--outline {
    flex: 1;
    padding: 12px 24px;
    border: 2px solid #e5e7eb;
    background: #fff;
    color: #374151;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-form__btn--outline:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.error-form__btn--primary {
    flex: 1.5;
    padding: 12px 24px;
    border: none;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.error-form__btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

.error-form__btn--primary:active {
    transform: translateY(0);
}

.error-form__btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== 刷新按钮旋转动画 ========== */
@keyframes em-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.error-form__captcha-refresh.spinning i {
    animation: em-spin 0.6s linear;
}

/* ========== 响应式适配 ========== */
@media (max-width: 640px) {
    .error-modal__content {
        width: 95%;
        border-radius: 12px;
    }

    .error-modal__header {
        padding: 20px 16px 16px;
    }

    .error-modal__body {
        padding: 20px 16px;
    }

    .error-modal__icon {
        width: 40px;
        height: 40px;
    }

    .error-modal__icon i {
        font-size: 1.25rem;
    }

    .error-modal__title {
        font-size: 1.125rem;
    }

    .error-form__radio-group {
        gap: 8px;
    }

    .error-form__radio {
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    .error-form__captcha {
        flex-wrap: wrap;
    }

    .error-form__captcha-input {
        width: 100%;
        flex: none;
        order: 3;
    }

    .error-form__actions {
        margin-top: 24px;
    }

    .error-form__btn--outline,
    .error-form__btn--primary {
        padding: 10px 20px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .error-form__radio-group {
        gap: 6px;
    }

    .error-form__radio {
        padding: 6px 10px;
        font-size: 0.8125rem;
    }

    .error-form__textarea {
        padding: 12px 14px;
        font-size: 0.875rem;
    }

    .error-form__captcha-canvas,
    .error-form__captcha-img {
        width: 100px;
        height: 36px;
    }

    .error-form__captcha-refresh {
        width: 36px;
        height: 36px;
    }

    .error-form__captcha-input {
        height: 36px;
        font-size: 0.875rem;
    }
}
