/* ==================== Demo Modal ==================== */
.demo-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    justify-content: safe center;
    align-items: safe center;
    overflow-x: auto;
    overflow-y: auto;
    padding: 0 50px;
    box-sizing: border-box;
}

.demo-modal-overlay.active {
    display: flex;
}

.demo-modal {
    position: relative;
    background: #fff;
    border-radius: 12px;
    border: 3px solid #aa2331;
    padding: 50px 60px;
    margin: 50px 0;
    max-width: 1100px;
    min-width: 770px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.demo-form {
    max-width: 545px;
    margin: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
}

.form-input-wrap {
    display: flex;
    align-items: baseline;
}

.form-error {
    color: #aa2331;
    font-size: 12px;
    margin-top: 4px;
    padding-left: 52px;
}

.form-error:empty {
    display: none;
}

.form-group.form-theme {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
}

.form-theme-options {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: space-between;
    row-gap: 10px;
    min-width: 0;
}

.form-theme-options .radio-label {
    width: auto;
    margin-right: 0;
    margin-bottom: 0;
}

.form-label {
    font-weight: bold;
    font-size: 16px;
    white-space: nowrap;
    width: 52px;
}

.form-input-wrap input[type="text"],
.form-input-wrap input[type="email"],
.form-input-wrap input[type="tel"],
.form-input-wrap textarea {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 14px;
    outline: none;
    font-family: 微软雅黑, sans-serif;
}

.form-input-wrap input:focus,
.form-input-wrap textarea:focus {
    border-color: #aa2331;
}

.form-group textarea {
    resize: none;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    margin-right: 16px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.radio-label:has(input:checked) {
    font-weight: bold;
    color: #aa2331;
}

.radio-label input[type="radio"] {
    margin-right: 4px;
    accent-color: #aa2331;
    width: 16px;
    height: 16px;
}

.form-captcha-wrap {
    align-items: center;
}

.form-captcha-wrap .captcha-input {
    flex: 1;
}

.captcha-img {
    width: 90px;
    height: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    margin-left: 8px;
    flex-shrink: 0;
    display: block;
}

.captcha-refresh {
    font-size: 20px;
    color: #aa2331;
    cursor: pointer;
    margin-left: 6px;
    user-select: none;
    flex-shrink: 0;
}

.captcha-refresh:hover {
    color: #8e1d29;
}

.submit-btn {
    width: 100%;
    background: #aa2331;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #8e1d29;
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== Toast ==================== */
.form-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 15px;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s;
    white-space: nowrap;
}

.form-toast.active {
    opacity: 1;
}

.form-toast.success {
    background: #2e7d32;
}

.form-toast.error {
    background: #aa2331;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .demo-modal-overlay {
        padding: 0 20px;
    }
    .demo-modal {
        min-width: auto;
        max-width: 100%;
        padding: 30px 20px;
    }
    .modal-close {
        top: 10px;
        right: 15px;
        font-size: 28px;
    }
    .form-input-wrap {
        flex-direction: column;
        gap: 6px;
    }
    .form-label {
        width: auto;
        font-size: 15px;
    }
    .form-theme-options {
        grid-template-columns: repeat(2, auto);
        justify-content: flex-start;
        gap: 8px 20px;
    }
    .form-error {
        padding-left: 0;
    }
    .form-input-wrap input[type="text"],
    .form-input-wrap input[type="email"],
    .form-input-wrap input[type="tel"],
    .form-input-wrap textarea {
        width: 100%;
    }

    /* 验证码行：手机端保持横向 */
    .form-captcha-wrap {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
    }
    .form-captcha-wrap .form-label {
        width: 100%;
        text-align: left;
    }
    .form-captcha-wrap .captcha-input {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .demo-modal-overlay {
        padding: 20px;
    }
    .demo-modal {
        padding: 24px 14px;
        border-width: 2px;
    }
    .modal-close {
        top: 8px;
        right: 10px;
        font-size: 24px;
    }
    .form-label {
        font-size: 14px;
    }
    .form-theme-options {
        grid-template-columns: repeat(2, auto);
        gap: 10px 40px;
    }
    .radio-label {
        font-size: 14px;
        margin-right: 10px;
    }
    .submit-btn {
        padding: 12px 0;
        font-size: 15px;
    }
}
